import React, { Component } from "react";

import { BrowserRouter as Router, Route, Link, Redirect, Switch } from "react-router-dom";
import {
    Layout, Menu, Icon, Table, Divider, Button, Modal, Form, Input, DatePicker,
    Select, Popconfirm, message, Alert, TreeSelect, TimePicker, Tree,
    AutoComplete, Tabs, Col, Row, Dropdown, Card, Pagination, Spin, Skeleton,
    Drawer, Tag, Badge, Radio, Steps, Transfer, notification, Empty, Calendar, Checkbox, Upload, List, Avatar
} from "antd";
import { iconFontUrl, zhizhouitemUploadTemplateUrl, zhizhouClassNameUploadTemplateUrl, inspectitemUploadTemplateUrl, zhizhourelationUploadTemplateUrl } from "../js/config.js";
import {
    getDutyCategoryItemNumApi, getDutyBluetoothCategoryApi, getDutyCategoryandUserDefinedTabledataApi, getDutyWeekConditionForSelectApi, addCheckpointAndCategoryApi, getDutyWeekConditionForSelectDetailApi,
    getDutyallitemApi, getCheckpointAndCategoryApi, getCheckpointFromCategoryApi, getBluetoothDeviceByCategoryApi, getBlueToothForClassApi, getBlueToothClassUseApi,
    getNotBlueToothClassApi, getClassFromBlueToothApi, getDutyWeekCheckpointApi, getDutyWeekClassNotInRelationApi,
    getDutyWeekConditionUserApi, allSchoolApi, SchoolAllApi, getDutyWeekConditionForClassIdApi, getDutyWeekConditionTermApi, getDutyWeekCurrentCategoryId, 
    getAllZhiZhouClassApi,
    getAllDutyWeekContentApi,
    addDutyWeekContentApi,
    updateDutyWeekContentApi,
    deleteDutyWeekContentApi,
    getAllDutyWeekPlaceApi,
    addDutyWeekPlaceApi,
    updateDutyWeekPlaceApi,
    deleteDutyWeekPlaceApi,
    DisplaygetAllDutyWeekCategoryApi,
    getCheckPointForCategoryApi,
    DisgetClassForBlueToothApi,
    addZhiZhouRelationApi,
} from '../js/api.js'

//import echarts from 'echarts';
import * as echarts from 'echarts';

import {
    getPatrolCountByDay, getInspectTimeByDay, getTroublePoint, getTroubleItem,
    getPatrolCountAll, getTodayInfo, getAllTimeInfo
} from "../js/api.js";

//值周统计使用
import {
    getRealAndAllDutyWeekNumber, getDutyWeekQuestionNumberByDay, getDutyWeekQuestionRank, getDutyWeekQuestionAddressRank, getDutyWeekNumberToDay
} from "../js/api.js";

import { addZhiZhouItemBySchoolIdApi, addZhiZhouClassNmeBySchoolIdApi, addDutyBluetoothDeviceApi, deleteCheckpointFromCategoryApi, updateDutyBluetoothDeviceApi, deleteDutyBluetoothDeviceApi, updateBlueToothToClassApi, deleteBlueToothToClassApi, addDutyUserDefinedContentApi, deleteContentTableDtatalByItemApi } from '../js/api.js'


import { addDutyWeekCategoryApi, getAllDutyWeekCategoryApi, deleteDutyWeekCategoryApi, updateDutyWeekCategoryApi } from '../js/api.js'
import { min } from "moment";


const { TreeNode } = Tree;
const RangePicker = DatePicker.RangePicker;
const IconFont = Icon.createFromIconfontCN({
    scriptUrl: iconFontUrl,
});
// const echarts = require('echarts');

const { Step } = Steps;
const TabPane = Tabs.TabPane;
const FormItem = Form.Item;
const Option = Select.Option;

const success = () => {
    message.success({
        content: '操作成功',
        className: 'custom-class',
        style: {
            marginTop: '48vh',
        },
    });
};
const fail = () => {
    message.success({
        content: '操作失败',
        className: 'custom-class',
        style: {
            marginTop: '48vh',
        },
    });
};

class Dutyweekpointsetup extends Component{
    
        constructor(props) {
            super(props);
            let url = document.location.href;
            this.state = {
                updateVisible: false, //控制新增用户模态框显示隐藏
                //addMyselfVisible: false,
                alertVisible: false,
                confirmLoading: false,
                msg: "", //提交失败时的提示语
                // searchText: '',
                tableLoading: true,
                ContentTableLoading: true,
                pointouterData: [],
                contentouterData: [],
                categoryIdList: [1, 2, 3],
                categoryNameList: [],
                categoryItemNum: [],
                currentcategoryId: 1,
                key: 1,
               // modaltype: "dutycontent",
                // filteredInfo: null,
                // sortedInfo: null,
    
            };
        }
    
        componentDidMount() {
            this.refreshData();
        }
    
       async refreshData() {
    
    
            let contentcolumnData = [];
            let pointcolumnData = [];
    
    
    
            const res= await getDutyCategoryItemNumApi(parseInt(sessionStorage.getItem("departmentId")))
                
                    let categoryIdList = [];
                    let categoryNameList = [];
                    let categoryItemNum = [];
                    let minC=999;
                    res.data.forEach((value, i) => {
                        minC=Math.min(minC, value.id)
                        let item = {
                            categoryId: value.id,
                            category: value.category
                        }
                        categoryNameList.push(item)
    
                    })
                    console.log("zz", minC)
    
                    this.setState({
                        categoryIdList: categoryIdList,
                        categoryNameList: categoryNameList,
                        categoryItemNum: categoryIdList,
                        currentcategoryId: minC,
                        key: minC
                    });
                    console.log("zzz", this.state.key)
    
                
           
             
                    const res2= await  getDutyCategoryandUserDefinedTabledataApi(parseInt(sessionStorage.getItem("departmentId")), this.state.key)
                
                    console.log("sss", this.state.key)
                    console.log("sss2", res.data)
                    res2.data.item.forEach((value, i) => {
                        contentcolumnData.push({
                            key: i + 1,
                            content: value,
                        });
                    })
                    res2.data.zhiZhouAddress.forEach((item, i) => {
                        pointcolumnData.push({
                            key: i + 1,
                            pointId: item.id,
                            point: item.address,
                        });
                    })
    
                    this.setState({
                        contentouterData: contentcolumnData,
                        pointouterData: pointcolumnData,
                        tableLoading: false,
                        ContentTableLoading: false,
                    });
               
            
    
 
            
            
    
        }
    
        tabChange = (key) => {
    
            this.setState({
    
                ContentTableLoading: true,
                tableLoading: true,
                key: key,
                currentcategoryId: key
            })
    
    
    
            let contentcolumnData = [];
            let pointcolumnData = [];
    
    
            getDutyCategoryandUserDefinedTabledataApi(parseInt(sessionStorage.getItem("departmentId")), parseInt(key))
                .then((res) => {
    
    
    
                    res.data.item.forEach((value, i) => {
                        contentcolumnData.push({
                            key: i + 1,
                            content: value,
    
    
                        });
                    })
    
    
                    res.data.zhiZhouAddress.forEach((item, i) => {
                        pointcolumnData.push({
                            key: i + 1,
                            pointId: item.id,
                            point: item.address,
    
                        });
                    })
    
    
    
                    this.setState({
                        contentouterData: contentcolumnData,
                        pointouterData: pointcolumnData,
                        tableLoading: false,
                        ContentTableLoading: false,
    
    
                    });
    
    
    
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message)
                    }
                    console.info(e.config)
                });
    
    
    
    
    
    
    
        }
    
        handleDeleteByItem(item) {
            console.log(item)
            // if (this.state.modaltype == "dutycontent") {
            //     deleteContentTableDtatalByItemApi(parseInt(sessionStorage.getItem("departmentId")), parseInt(this.state.currentcategoryId), item,)
    
            //         .then((res) => {
            //             if (res.data == "success") {
            //                 message.success("删除成功!");
            //                 this.refreshData();
            //                 this.state.that.refreshData();
            //             } else {
            //                 message.error('删除失败,请稍后再试!');
            //             }
            //         })
            //         .catch((e) => {
            //             if (e.response) {
            //                 //请求已发出，服务器返回状态码不是2xx。
            //                 console.info(e.response.data)
            //                 console.info(e.response.status)
            //                 console.info(e.response.headers)
            //             } else if (e.request) {
            //                 // 请求已发出，但没有收到响应
            //                 // e.request 在浏览器里是一个XMLHttpRequest实例，
            //                 // 在node中是一个http.ClientRequest实例
            //                 console.info(e.request)
            //             } else {
            //                 //发送请求时异常，捕捉到错误
            //                 console.info('error', e.message)
            //             }
            //             console.info(e.config)
            //         });
            // }
    
         
                deleteCheckpointFromCategoryApi(parseInt(sessionStorage.getItem("departmentId")), parseInt(this.state.currentcategoryId), item,)
    
                    .then((res) => {
                        if (res.data == "success") {
                            message.success("删除成功!");
                            this.refreshData();
                            this.state.that.refreshData();
                        } else {
                            message.error('删除失败,请稍后再试!');
                        }
                    })
                    .catch((e) => {
                        if (e.response) {
                            //请求已发出，服务器返回状态码不是2xx。
                            console.info(e.response.data)
                            console.info(e.response.status)
                            console.info(e.response.headers)
                        } else if (e.request) {
                            // 请求已发出，但没有收到响应
                            // e.request 在浏览器里是一个XMLHttpRequest实例，
                            // 在node中是一个http.ClientRequest实例
                            console.info(e.request)
                        } else {
                            //发送请求时异常，捕捉到错误
                            console.info('error', e.message)
                        }
                        console.info(e.config)
                    });
            
        }
    
    
        showUpdateModal(e) {
    
            console.log(e.target.value)
    
    
            this.setState({
                // : e.target.value,modaltype

                updateVisible: true
            });
        }
    
        handleSearch = (selectedKeys, confirm) => () => {
            confirm();
            // this.setState({ searchText: selectedKeys[0] });
        }
    
        handleReset = clearFilters => () => {
            clearFilters();
            // this.setState({ searchText: '' });
        }
    
        //关闭更新信息模态框
        handleUpdateCancel() {
            this.setState({
                alertVisible: false,
                updateVisible: false
            });
            console.log('handleUpdateCancel');
        }
    
        //关闭 alert 的提示
        handleClose() {
            this.setState({ alertVisible: false });
        }
    
        onRef = (ref) => {
            this.child = ref
        }
    
        render() {
            // const contentouterColumns = [
            //     {
            //         title: "序号",
            //         dataIndex: "key",
            //         key: "key"
            //     }, {
            //         title: "值周内容",
            //         dataIndex: "content",
            //         key: "content",
            //         filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
            //             <div className="custom-filter-dropdown">
            //                 <Input
            //                     ref={ele => this.searchInput = ele}
            //                     value={selectedKeys[0]}
            //                     onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
            //                     onPressEnter={this.handleSearch(selectedKeys, confirm)}
            //                 />
            //                 <Button type="primary" onClick={this.handleSearch(selectedKeys, confirm)}>查找</Button>
            //                 <Button onClick={this.handleReset(clearFilters)}>重置</Button>
            //             </div>
            //         ),
            //         filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#108ee9' : '#aaa', fontSize: '1.2em' }} />,
            //         onFilter: (value, record) => record.item.toLowerCase().includes(value.toLowerCase()),
            //         onFilterDropdownVisibleChange: (visible) => {
            //             if (visible) {
            //                 setTimeout(() => {
            //                     this.searchInput.focus();
            //                 });
            //             }
            //         }
            //     },
    
            //     {
            //         title: "操作详情",
            //         key: "action",
            //         render: (text, record) => (
            //             <span>
            //                 <Popconfirm title="确定删除？" okText="确定" cancelText="取消"
            //                     onConfirm={() => this.handleDeleteByItem(record.content)}>
            //                     <a href="#">删除</a>
            //                 </Popconfirm>
            //             </span>
            //         )
            //     }];
    
    
            const pointouterColumns = [
                {
                    title: "序号",
                    dataIndex: "key",
                    key: "key"
                }, {
                    title: "值周打卡点",
                    dataIndex: "point",
                    key: "point",
                    filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
                        <div className="custom-filter-dropdown">
                            <Input
                                ref={ele => this.searchInput = ele}
                                value={selectedKeys[0]}
                                onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
                                onPressEnter={this.handleSearch(selectedKeys, confirm)}
                            />
                            <Button type="primary" onClick={this.handleSearch(selectedKeys, confirm)}>查找</Button>
                            <Button onClick={this.handleReset(clearFilters)}>重置</Button>
                        </div>
                    ),
                    filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#108ee9' : '#aaa', fontSize: '1.2em' }} />,
                    onFilter: (value, record) => record.item.toLowerCase().includes(value.toLowerCase()),
                    onFilterDropdownVisibleChange: (visible) => {
                        if (visible) {
                            setTimeout(() => {
                                this.searchInput.focus();
                            });
                        }
                    }
                },
    
                {
                    title: "操作详情",
                    key: "action",
                    render: (text, record) => (
                        <span>
                            <Popconfirm title="确定删除？" okText="确定" cancelText="取消"
                                onConfirm={() => this.handleDeleteByItem(record.pointId)}>
                                <a href="#">删除</a>
                            </Popconfirm>
                        </span>
                    )
                }];
    
            const tabs = this.state.categoryNameList.map((d, index) =>
    
                <TabPane
                    tab={
                        <div data-id={d.categoryId}>{d.category}
                        </div>
                    }
                    key={d.categoryId}>
    
                    {/* {this.state.modaltype == "dutycontent" ?
                        <Table
                            style={{ marginTop: '20px', height: "100%" }}
                            dataSource={this.state.contentouterData}
                            columns={contentouterColumns}
                            loading={this.state.ContentTableLoading}
                            locale={{ emptyText: '暂无数据' }}
                            //   可扩展行 expandedRowRender={(record) => {
                            //     return (
                            //         <ManualInnerTable
                            //             onRef={this.onRef}
                            //             item={record.item}
                            //             that={this} />)
                            // }}
                            rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                            pagination={{  //分页
                                total: this.state.contentouterData.length, //数据总数量
                                defaultPageSize: 10, //默认显示几条一页
                                pageSize: 10,
                                showTotal: function (total) {  //设置显示一共几条数据
                                    return '共 ' + total + ' 条数据';
                                },
                                showSizeChanger: true,
                                showQuickJumper: true,
                                pageSizeOptions: [5, 10, 20, 30]
                            }}
                        />
                        : */}
    
                        <Table
                            style={{ marginTop: '20px', height: "100%" }}
                            dataSource={this.state.pointouterData}
                            columns={pointouterColumns}
                            loading={this.state.tableLoading}
                            locale={{ emptyText: '暂无数据' }}
    
                            rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                            pagination={{  //分页
                                total: this.state.pointouterData.length, //数据总数量
                                defaultPageSize: 10, //默认显示几条一页
                                pageSize: 10,
                                showTotal: function (total) {  //设置显示一共几条数据
                                    return '共 ' + total + ' 条数据';
                                },
                                showSizeChanger: true,
                                showQuickJumper: true,
                                pageSizeOptions: [5, 10, 20, 30]
                            }}
                        />
                </TabPane>
            );
    
    
            return (
                <div>
                    
                        <div style={{ marginBottom: 16 }}>
    
                            <UpdateDutypointManualForm
                                visible={this.state.updateVisible}
                                currentcategoryId={this.state.key}
                                that={this} />  </div>
                    
    
    
                    <Tabs
                        tabBarStyle={{
                            width: '300px'
                        }}
                        onChange={this.tabChange}
                        onTabClick={this.tabChange}
                        size='large'
                        stle={{ height: "35%" }}
                        defaultActiveKey="1"
                        tabPosition="left"
                    >
                        {/* <Button type="primary" onClick={this.showUpdateModal.bind(this)} value="dutycontent" size="large">
                            <Icon type="usergroup-add" theme="outlined" style={{ marginLeft: "15px" }} />值周内容配置
                        </Button> */}
                        <Button type="primary" onClick={this.showUpdateModal.bind(this)} value="dutypoint" style={{ marginLeft: "15px" }} size="large">
                            <Icon type="icon-didian" theme="outlined" />值周打卡点配置
                        </Button>
                        {/* <Alert style={{ display: 'table', marginTop: 15}} message="1、点击值周打卡点配置->勾选值周打卡点, 2、点击值周内容配置->勾选值周内容" type="info" showIcon/> */}
                        {tabs}
    
                    </Tabs>
                </div>
            )
        }
    
}

class Dutyweeksetup extends Component {
    constructor(props) {
        super(props);
        let url = document.location.href;
        this.state = {
            updateVisible: false, //控制新增用户模态框显示隐藏
            //addMyselfVisible: false,
            alertVisible: false,
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            // searchText: '',
            tableLoading: true,
            ContentTableLoading: true,
            pointouterData: [],
            contentouterData: [],
            categoryIdList: [1, 2, 3],
            categoryNameList: [],
            categoryItemNum: [],
            currentcategoryId: 1,
            key: 0,
            modaltype: "dutycontent",
            // filteredInfo: null,
            // sortedInfo: null,

        };
    }

    componentDidMount() {
        this.refreshData();
    }

   async refreshData() {


        let contentcolumnData = [];
        let pointcolumnData = [];



      const res= await getDutyCategoryItemNumApi(parseInt(sessionStorage.getItem("departmentId")))
           
                let categoryIdList = [];
                let categoryNameList = [];
                let categoryItemNum = [];
                let currentcategoryId=999;
                res.data.forEach((value, i) => {
                    currentcategoryId=Math.min(currentcategoryId, value.id)
                    let item = {
                        categoryId: value.id,
                        category: value.category
                    }
                    categoryNameList.push(item)

                })

                this.setState({
                    categoryIdList: categoryIdList,
                    categoryNameList: categoryNameList,
                    categoryItemNum: categoryIdList,
                    currentcategoryId: currentcategoryId,
                    key: currentcategoryId
                });


            
        
        
         
                const res2= await getDutyCategoryandUserDefinedTabledataApi(parseInt(sessionStorage.getItem("departmentId")), this.state.key)
           
console.log("tesst", this.state.key)
                res2.data.item.forEach((value, i) => {
                    contentcolumnData.push({
                        key: i + 1,
                        content: value,
                    });
                })
                res2.data.zhiZhouAddress.forEach((item, i) => {
                    pointcolumnData.push({
                        key: i + 1,
                        pointId: item.id,
                        point: item.address,
                    });
                })

                this.setState({
                    contentouterData: contentcolumnData,
                    pointouterData: pointcolumnData,
                    tableLoading: false,
                    ContentTableLoading: false,
                });
        
            
    
        
        

    }

    tabChange = (key) => {
        console.log("key", key)
        this.setState({

            ContentTableLoading: true,
            tableLoading: true,
            key: key,
            currentcategoryId: key
        })



        let contentcolumnData = [];
        let pointcolumnData = [];


        getDutyCategoryandUserDefinedTabledataApi(parseInt(sessionStorage.getItem("departmentId")), parseInt(key))
            .then((res) => {



                res.data.item.forEach((value, i) => {
                    contentcolumnData.push({
                        key: i + 1,
                        content: value,


                    });
                })


                res.data.zhiZhouAddress.forEach((item, i) => {
                    pointcolumnData.push({
                        key: i + 1,
                        pointId: item.id,
                        point: item.address,

                    });
                })



                this.setState({
                    contentouterData: contentcolumnData,
                    pointouterData: pointcolumnData,
                    tableLoading: false,
                    ContentTableLoading: false,


                });



            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });







    }

    handleDeleteByItem(item) {
        console.log(item)
        if (this.state.modaltype == "dutycontent") {
            deleteContentTableDtatalByItemApi(parseInt(sessionStorage.getItem("departmentId")), parseInt(this.state.currentcategoryId), item,)

                .then((res) => {
                    if (res.data == "success") {
                        message.success("删除成功!");
                        this.refreshData();
                        this.state.that.refreshData();
                    } else {
                        message.error('删除失败,请稍后再试!');
                    }
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message)
                    }
                    console.info(e.config)
                });
        }

        else {
            deleteCheckpointFromCategoryApi(parseInt(sessionStorage.getItem("departmentId")), parseInt(this.state.currentcategoryId), item,)

                .then((res) => {
                    if (res.data == "success") {
                        message.success("删除成功!");
                        this.refreshData();
                        this.state.that.refreshData();
                    } else {
                        message.error('删除失败,请稍后再试!');
                    }
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message)
                    }
                    console.info(e.config)
                });
        }
    }


    showUpdateModal(e) {
        console.log("++=", e)
        console.log("++", e.target.value)


        this.setState({
            modaltype: e.target.value,
            updateVisible: true
        });
    }

    handleSearch = (selectedKeys, confirm) => () => {
        confirm();
        // this.setState({ searchText: selectedKeys[0] });
    }

    handleReset = clearFilters => () => {
        clearFilters();
        // this.setState({ searchText: '' });
    }

    //关闭更新信息模态框
    handleUpdateCancel() {
        this.setState({
            alertVisible: false,
            updateVisible: false
        });
        console.log('handleUpdateCancel');
    }

    //关闭 alert 的提示
    handleClose() {
        this.setState({ alertVisible: false });
    }

    onRef = (ref) => {
        this.child = ref
    }

    render() {
        const contentouterColumns = [
            {
                title: "序号",
                dataIndex: "key",
                key: "key"
            }, {
                title: "值周内容",
                dataIndex: "content",
                key: "content",
                filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
                    <div className="custom-filter-dropdown">
                        <Input
                            ref={ele => this.searchInput = ele}
                            value={selectedKeys[0]}
                            onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
                            onPressEnter={this.handleSearch(selectedKeys, confirm)}
                        />
                        <Button type="primary" onClick={this.handleSearch(selectedKeys, confirm)}>查找</Button>
                        <Button onClick={this.handleReset(clearFilters)}>重置</Button>
                    </div>
                ),
                filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#108ee9' : '#aaa', fontSize: '1.2em' }} />,
                onFilter: (value, record) => record.item.toLowerCase().includes(value.toLowerCase()),
                onFilterDropdownVisibleChange: (visible) => {
                    if (visible) {
                        setTimeout(() => {
                            this.searchInput.focus();
                        });
                    }
                }
            },

            {
                title: "操作详情",
                key: "action",
                render: (text, record) => (
                    <span>
                        <Popconfirm title="确定删除？" okText="确定" cancelText="取消"
                            onConfirm={() => this.handleDeleteByItem(record.content)}>
                            <a href="#">删除</a>
                        </Popconfirm>
                    </span>
                )
            }];


        const pointouterColumns = [
            {
                title: "序号",
                dataIndex: "key",
                key: "key"
            }, {
                title: "值周打卡点",
                dataIndex: "point",
                key: "point",
                filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
                    <div className="custom-filter-dropdown">
                        <Input
                            ref={ele => this.searchInput = ele}
                            value={selectedKeys[0]}
                            onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
                            onPressEnter={this.handleSearch(selectedKeys, confirm)}
                        />
                        <Button type="primary" onClick={this.handleSearch(selectedKeys, confirm)}>查找</Button>
                        <Button onClick={this.handleReset(clearFilters)}>重置</Button>
                    </div>
                ),
                filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#108ee9' : '#aaa', fontSize: '1.2em' }} />,
                onFilter: (value, record) => record.item.toLowerCase().includes(value.toLowerCase()),
                onFilterDropdownVisibleChange: (visible) => {
                    if (visible) {
                        setTimeout(() => {
                            this.searchInput.focus();
                        });
                    }
                }
            },

            {
                title: "操作详情",
                key: "action",
                render: (text, record) => (
                    <span>
                        <Popconfirm title="确定删除？" okText="确定" cancelText="取消"
                            onConfirm={() => this.handleDeleteByItem(record.pointId)}>
                            <a href="#">删除</a>
                        </Popconfirm>
                    </span>
                )
            }];

        const tabs = this.state.categoryNameList.map((d, index) =>
            // console.log("===", d),
            <TabPane
                tab={ 
                    <div data-id={d.categoryId}>{d.category}
                    </div>
                }
            
                key={d.categoryId}>

               
                    <Table
                        style={{ marginTop: '20px', height: "100%" }}
                        dataSource={this.state.contentouterData}
                        columns={contentouterColumns}
                        loading={this.state.ContentTableLoading}
                        locale={{ emptyText: '暂无数据' }}
                        //   可扩展行 expandedRowRender={(record) => {
                        //     return (
                        //         <ManualInnerTable
                        //             onRef={this.onRef}
                        //             item={record.item}
                        //             that={this} />)
                        // }}
                        rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                        pagination={{  //分页
                            total: this.state.contentouterData.length, //数据总数量
                            defaultPageSize: 10, //默认显示几条一页
                            pageSize: 10,
                            showTotal: function (total) {  //设置显示一共几条数据
                                return '共 ' + total + ' 条数据';
                            },
                            showSizeChanger: true,
                            showQuickJumper: true,
                            pageSizeOptions: [5, 10, 20, 30]
                        }}
                    />
                

                   
                
            </TabPane>
        );


        return (
            <div>
                {this.state.modaltype == "dutycontent" ?
                    <div style={{ marginBottom: 16 }}>
                        <UpdateDutycontentManualForm
                            visible={this.state.updateVisible}
                            currentcategoryId={this.state.key}
                            that={this} /></div>

                    :
                    <div style={{ marginBottom: 16 }}>

                        <UpdateDutypointManualForm
                            visible={this.state.updateVisible}
                            currentcategoryId={this.state.key}
                            that={this} />  </div>
                }


                <Tabs
                    tabBarStyle={{
                        width: '300px'
                    }}
                    onChange={this.tabChange}
                    onTabClick={this.tabChange}
                    size='large'
                    stle={{ height: "35%" }}
                    defaultActiveKey="1"
                    tabPosition="left"
                >
                    <Button type="primary" onClick={this.showUpdateModal.bind(this)} value="dutycontent" size="large">
                        <Icon type="usergroup-add" theme="outlined" style={{ marginLeft: "15px" }} />值周内容配置
                    </Button>
                    
                    {/* <Alert style={{ display: 'table', marginTop: 15}} message="1、点击值周打卡点配置->勾选值周打卡点, 2、点击值周内容配置->勾选值周内容" type="info" showIcon/> */}
                    {tabs}

                </Tabs>
            </div>
        )
    }
}



class schoolDutyWeekConditionManager extends Component {
    constructor(props) {
        super(props);
        let url = document.location.href;
        this.state = {
            //detailVisible: false,
            alertVisible: false, //提示
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            tableLoading: true,
            data: [],
            filteredInfo: null,
            sortedInfo: null,
            // searchText: '',
            // allCategory: [],
            // allStatus: []
            isSearch: false,
            classNameArr: [],

            categoryNameArr: [],
            dutyAllItemArr: [],
            realNameArr: [],
            existCategory: [],
            searchData: [],
            filteredInfo2: null,
            sortedInfo2: null,
            // searchText2: '',

            detailVisible: false,
            detailExist: false,
            photoUrl: '',
            photoVisible: false,

            searchChartLoading: true,
            chartInspectSearchData: {}
        };

    }

    componentDidMount() {
        this.refreshData();
        console.log("url=====================", document.location.href)
    }

    refreshData() {





        getDutyWeekConditionForSelectApi(parseInt(sessionStorage.getItem("departmentId")))
            .then((res) => {
                this.setState({
                    tableLoading: true
                })

                let classNameArr = []
                let categoryNameArr = []
                let dutyAllItemArr = []
                //let statusData = [];
                let realNameArr = []

                res.data.category.map((item) => {
                    categoryNameArr.push({
                        value: item.category,
                        key: item.id
                    })
                })

                res.data.dutyAllItem.map((item) => {
                    dutyAllItemArr.push(
                        item.item

                    )
                })
                res.data.className.map((item) => {
                    classNameArr.push(
                        item.classname

                    )
                })

                this.setState({
                    classNameArr: classNameArr,
                    categoryNameArr: categoryNameArr,
                    dutyAllItemArr: dutyAllItemArr,
                    realNameArr: res.data.realName,
                    tableLoading: false,
                    alertVisible: false,
                });
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });

        getAllZhiZhouClassApi(parseInt(sessionStorage.getItem("departmentId")))
            .then((res) => {

                let columnData = []

                res.data.map((item, index) => {
                    columnData.push({
                        ...item, key: index + 1, daycircle: "1"
                    })
                })


                this.setState({
                    columnData: columnData,

                });
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });

    }

    searchSubmit = (e) => {
        e.preventDefault();
        this.props.form.validateFields((err, values) => {

            if (values.classname == undefined && values.deadline == undefined
                && values.doneResult == undefined && values.item == undefined && values.realName == undefined) {
                message.error('请至少填写一项条件再进行搜索');
            } else {
                this.setState({
                    tableLoading: true,
                    isSearch: true,
                });
                getDutyWeekConditionTermApi(sessionStorage.getItem("departmentId"), values)
                    .then(res => {
                        let searchData = [];

                        res.data.forEach((item, index) => {


                            searchData.push({
                                key: index + 1,
                                category: item.category,
                                categoryId: item.categoryId,
                                className: item.className,
                                content: item.content ? item.content : '无',
                                modifyTime: item.modifyTime,
                                item: item.item,
                                realname: item.realName1,
                                status: item.status,
                                id: item.id,
                                photoUrl: item.photo

                            });

                        });
                        this.setState({

                            searchData: searchData,
                            tableLoading: false,
                            alertVisible: false,
                        });
                    })
                    .catch((e) => {
                        if (e.response) {
                            //请求已发出，服务器返回状态码不是2xx。
                            console.info(e.response.data)
                            console.info(e.response.status)
                            console.info(e.response.headers)
                        } else if (e.request) {
                            // 请求已发出，但没有收到响应
                            // e.request 在浏览器里是一个XMLHttpRequest实例，
                            // 在node中是一个http.ClientRequest实例
                            console.info(e.request)
                        } else {
                            //发送请求时异常，捕捉到错误
                            console.info('error', e.message)
                        }
                        console.info(e.config)
                    });


            }
        })
    }

    handleDetailDrawerCancel() {
        this.setState({
            detailVisible: false,
        })
    }

    //关闭 alert 的提示
    handleClose() {
        this.setState({ alertVisible: false });
    }

    clearAll = () => {
        this.setState({
            filteredInfo: null,
            sortedInfo: null,
        });

    }

    handleChange = (pagination, filters, sorter) => {
        //console.log('Various parameters', pagination, filters, sorter);
        this.setState({
            filteredInfo: filters,
            sortedInfo: sorter,
        });
    }

    handleSearch = (selectedKeys, confirm) => () => {
        confirm();
        // this.setState({
        //     searchText: selectedKeys[0],
        // });
    }

    handleSearchReset = clearFilters => () => {
        clearFilters();
        // this.setState({
        //     searchText: '',
        // });
    }

    clearAll2 = () => {
        this.setState({
            filteredInfo2: null,
            sortedInfo2: null,
        });

    }

    handleChange2 = (pagination, filters, sorter) => {
        //console.log('Various parameters', pagination, filters, sorter);
        this.setState({
            filteredInfo2: filters,
            sortedInfo2: sorter,
        });
    }

    handleSearch2 = (selectedKeys, confirm) => () => {
        confirm();
        // this.setState({
        //     // searchText2: selectedKeys[0],
        // });
    }

    handleSearchReset2 = clearFilters => () => {
        clearFilters();
        // this.setState({
        //     // searchText2: '',
        // });
    }

    onRef = (ref) => {
        this.child = ref
        console.log(ref, "innertable")
    }

    searchReset = () => {
        this.props.form.resetFields();
        this.setState({
            isSearch: false,
        })
    }

    setFullScreen(opts) {
        this.setState({
            fullScreenVisible: true,
        })
        let fullchart = echarts.init(document.getElementById('fullScreen'))
        fullchart.setOption(opts);
    }

    fullScreenCancel() {
        this.setState({
            fullScreenVisible: false,
        })
    }

    showPhoto = (url) => {

        this.setState({
            photoUrl: url,
            photoVisible: true
        })

    }

    cancelPhoto = () => {
        this.setState({
            photoUrl: '',
            photoVisible: false
        })
    }


    render() {
        let { sortedInfo, filteredInfo } = this.state;
        sortedInfo = sortedInfo || {};
        filteredInfo = filteredInfo || {};
        //班级Id
        const columns = [{
            title: "序号",
            dataIndex: "key",
            key: "key",
            width: "15%",
            align: "left",

            filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
                <div className="custom-filter-dropdown">
                    <Input
                        ref={ele => this.searchInput = ele}
                        value={selectedKeys[0]}
                        onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
                        onPressEnter={this.handleSearch(selectedKeys, confirm)}
                    />
                    <Button type="primary" onClick={this.handleSearch(selectedKeys, confirm)}>查找</Button>
                    <Button onClick={this.handleSearchReset(clearFilters)}>重置</Button>
                </div>
            ),
            filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#108ee9' : '#aaa', fontSize: '1.2em' }} />,
            onFilter: (value, record) => record.classname.includes(value),
            onFilterDropdownVisibleChange: (visible) => {
                if (visible) {
                    setTimeout(() => {
                        this.searchInput.focus();
                    });
                }
            }

        },
        {
            title: "值周巡查点",
            dataIndex: "classname",
            key: "classname",
            width: "30%",
            align: "left",

        },

        {
            title: "值周打卡点",
            dataIndex: "address",
            width: "40%",
            key: "address",
            aligh: "center",
            render: (record) => {

                if (record == "未关联") {
                    return (<div><Tag color="orange">未关联</Tag></div>)
                }
                else
                    return (<div><Tag color="#108ee9">{record}</Tag></div>)


            }
        },
        {
            title: "值周周期/天",
            dataIndex: "daycircle",
            width: "15%",
            key: "daycircle",
        }];

        const { getFieldDecorator, getFieldValue } = this.props.form;
        let { sortedInfo2, filteredInfo2 } = this.state;
        sortedInfo2 = sortedInfo2 || {};
        filteredInfo2 = filteredInfo2 || {};


        let keyWidth = undefined;
        let classmatesWidth = undefined;
        let deadlineWidth = undefined;
        let categoryNameWidth = undefined;
        let doneStatusWidth = undefined;
        let actionWidth = undefined;

        let winWidth;
        // 获取窗口宽度
        if (window.innerWidth)
            winWidth = window.innerWidth;
        else if ((document.body) && (document.body.clientWidth))
            winWidth = document.body.clientWidth;
        if (winWidth < 1500) {
            keyWidth = 60;
            classmatesWidth = 200;
            deadlineWidth = 120;
            categoryNameWidth = 110;
            doneStatusWidth = 110;
            actionWidth = 110;
        }

        const columnsSearch = [{
            title: "序号",
            dataIndex: "key",
            key: "key",
            width: keyWidth,
        }, {
            title: "值周巡查点",
            dataIndex: "className",
            key: "className"
        }, {
            title: "值周内容",
            dataIndex: "item",
            key: "item",
            width: classmatesWidth
        }, {
            title: '异常记录',
            dataIndex: 'content',
            key: 'content',
        },
        {
            title: '完成情况',
            dataIndex: 'status',
            key: 'status',
            width: deadlineWidth,
            render: (text, record) => {


                if (record.status == 1) {
                    return (<div><Tag color={'green'}>正常</Tag></div>)
                }
                else if (record.status == 0) {
                    return (<div><Tag color={'red'}>异常</Tag></div>)
                }
            },
        },

        {
            title: '值周任务',
            dataIndex: 'category',
            key: 'category',
            width: doneStatusWidth,
            render: (text, record) => {

                console.log(record);
                if (record.categoryId == 1) {
                    return (<div><Tag color={'green'}>{record.category}</Tag></div>)
                } else if (record.categoryId == 2) {
                    return (<div><Tag color={'orange'}>{record.category}</Tag></div>)
                } else if (record.categoryId == 3) {
                    return (<div><Tag color={'red'}>{record.category}</Tag></div>)
                }

            },
        },
        {
            title: '值周员',
            dataIndex: 'realname',
            key: 'realname',
            width: deadlineWidth,
            sorter: (a, b) => new Date(a.deadline).getTime() - new Date(b.deadline).getTime(),
            sortOrder: sortedInfo2.columnKey === 'deadline' && sortedInfo2.order,
        },

        {
            title: '提交时间',
            dataIndex: 'modifyTime',
            key: 'modifyTime',
        },

        {
            title: '操作详情',
            dataIndex: 'photoUrl',
            key: 'photoUrl',
            render: (text, record) => {
                return (
                    <span>
                        <a
                            href="javascript:;"
                            onClick={this.showPhoto.bind(this, record.photoUrl)}
                        >
                            查看照片
                        </a>
                    </span>
                )
            },
        }

        ];

        let categoryOptions;
        if (this.state.existCategory.length != 0) {
            categoryOptions = this.state.existCategory.map((d, index) =>
                <Option value={d.id} key={index}>{d.category}</Option>
            );
        }

        let labelCol = {
            sm: { span: 6 },
            xl: { span: 6 },
            xxl: { span: 5 },
        };

        let wrapperCol = {
            sm: { span: 18 },
            xl: { span: 18 },
            xxl: { span: 19 },
        };

        return (
            <div style={{ marginBottom: 16 }}>
                <Form
                    style={{
                        padding: '12px',
                        backgroundColor: '#fafafa',
                        borderRadius: 8,
                        marginBottom: 16,
                    }}
                    layout="inline"
                    onSubmit={this.searchSubmit}>
                    <Row gutter={16}>

                        <Col span={8}>
                            <FormItem
                                label="值周巡查点"
                                style={{ width: '100%' }}
                                labelCol={labelCol}
                                wrapperCol={wrapperCol}>
                                {getFieldDecorator("classname", {
                                    rules: [{
                                        required: false,
                                    }]
                                })(
                                    <AutoComplete
                                        allowClear={true}
                                        style={{ width: '100%' }}

                                        dataSource={this.state.classNameArr}
                                        placeholder="请选择值周巡查点"
                                        filterOption={(inputValue, option) => option.props.children.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1}
                                    />
                                )}
                            </FormItem>

                        </Col>
                        <Col span={8}>
                            <FormItem
                                label="截止日期"
                                style={{ width: '100%' }}
                                labelCol={labelCol}
                                wrapperCol={wrapperCol}>
                                {getFieldDecorator("deadline", {
                                    rules: [{
                                        type: 'array',
                                        required: false,
                                    }]
                                })(
                                    <RangePicker
                                        style={{ width: '100%' }}
                                        format="YYYY-MM-DD" />
                                )}
                            </FormItem>
                        </Col>
                        <Col span={8}>
                            <FormItem
                                label="值周项"
                                style={{ width: '100%' }}
                                labelCol={labelCol}
                                wrapperCol={wrapperCol}>
                                {getFieldDecorator("item", {
                                    rules: [{
                                        required: false,
                                    }]
                                })(
                                    <AutoComplete
                                        allowClear={true}
                                        style={{ width: '100%' }}

                                        dataSource={this.state.dutyAllItemArr}
                                        placeholder="请选择值周内容"
                                        filterOption={(inputValue, option) => option.props.children.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1}
                                    />
                                )}
                            </FormItem>


                        </Col>





                    </Row>
                    <Row gutter={16}>
                        {/* <Col span={8}>
                            <FormItem
                                label="检查点"
                                style={{ width: '100%' }}
                                labelCol={labelCol}
                                wrapperCol={wrapperCol}>
                                {getFieldDecorator("checkpoint", {
                                    rules: [{
                                        required: false,
                                    }]
                                })(
                                    <AutoComplete
                                        allowClear={true}
                                        style={{ width: '100%' }}
                                        dataSource={this.state.realName}
                                        placeholder="请选择检查点"
                                        filterOption={(inputValue, option) => option.props.children.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1}
                                    />
                                )}
                            </FormItem>
                        </Col> */}
                        <Col span={8}>
                            <FormItem
                                label="值周员"
                                style={{ width: '100%' }}
                                labelCol={labelCol}
                                wrapperCol={wrapperCol}>
                                {getFieldDecorator("realName", {
                                    rules: [{
                                        required: false,
                                    }]
                                })(
                                    <AutoComplete
                                        allowClear={true}
                                        style={{ width: '100%' }}
                                        dataSource={this.state.realNameArr}
                                        placeholder="请选择查询值周员"

                                    />
                                )}
                            </FormItem>
                        </Col>

                        {/*                        
                        <Col span={8}>
                            <FormItem
                                label="完成情况"
                                style={{ width: '100%' }}
                                labelCol={labelCol}
                                wrapperCol={wrapperCol}>
                                {getFieldDecorator("doneStatus", {
                                    rules: [{
                                        required: false,
                                    }]
                                })(
                                    <Select
                                        allowClear={true}
                                        style={{ width: '100%' }}
                                        placeholder="请选择完成情况">
                                        <Option value="全部完成">全部完成</Option>
                                        <Option value="部分完成">部分完成</Option>
                                        <Option value="未完成">未完成</Option>
                                    </Select>
                                )}
                            </FormItem>
                        </Col> */}
                        <Col span={8}>
                            <FormItem
                                label="完成结果"
                                style={{ width: '100%' }}
                                labelCol={labelCol}
                                wrapperCol={wrapperCol}>
                                {getFieldDecorator("doneResult", {
                                    rules: [{
                                        required: false,
                                    }]
                                })(
                                    <Select
                                        allowClear={true}
                                        style={{ width: '100%' }}
                                        placeholder="请选择完成结果">
                                        <Option value={2}>一切正常</Option>

                                        <Option value={1}>有异常</Option>
                                    </Select>
                                )}
                            </FormItem>
                        </Col>
                    </Row>
                    <Row>
                        <FormItem
                            style={{ float: 'right' }}>
                            <Button type="primary" htmlType="submit">搜索</Button>
                            <Button style={{ marginLeft: 8 }} onClick={this.searchReset}>清空</Button>
                        </FormItem>
                    </Row>
                </Form>
                {this.state.isSearch ? (
                    <div>

                        <Table
                            dataSource={this.state.searchData}
                            columns={columnsSearch}
                            loading={this.state.tableLoading}
                            locale={{ emptyText: '暂无数据' }}
                            onChange={this.handleChange2}
                            rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                            pagination={{  //分页
                                total: this.state.searchData.length, //数据总数量
                                defaultPageSize: 10, //默认显示几条一页
                                //pageSize: 10,
                                showTotal: function (total) {  //设置显示一共几条数据
                                    return '共 ' + total + ' 条数据';
                                },
                                showSizeChanger: true,
                                showQuickJumper: true,
                                pageSizeOptions: [5, 10, 20, 30]
                            }} />
                    </div>
                ) : (
                    <Table
                        dataSource={this.state.columnData}
                        columns={columns}
                        loading={this.state.tableLoading}
                        locale={{ emptyText: '暂无数据' }}
                        onChange={this.handleChange}
                        expandedRowRender={(record) => {
                            return (
                                <DutyWeekConditionInnerTable
                                    //wrappedComponentRef={(inst) => this.teammateTableFormRef = inst}
                                    //ref="teammateTableRefresh"
                                    onRef={this.onRef}
                                    classnameId={record.id}
                                    that={this} />)
                        }}
                        rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                        pagination={{  //分页
                            total: this.state.data.length, //数据总数量
                            defaultPageSize: 10, //默认显示几条一页
                            //pageSize: 10,
                            showTotal: function (total) {  //设置显示一共几条数据
                                return '共 ' + total + ' 条数据';
                            },
                            showSizeChanger: true,
                            showQuickJumper: true,
                            pageSizeOptions: [5, 10, 20, 30]
                        }} />
                )}

                <Modal
                    destroyOnClose
                    visible={this.state.photoVisible}
                    title={'值周照片'}
                    footer={null}
                    width={800}

                    bodyStyle={{
                        padding: 24,
                        maxHeight: 600,
                        height: 600,
                        textAlign: 'center'
                    }}
                    onCancel={() => { this.cancelPhoto() }}>
                    <img
                        src={this.state.photoUrl == '' ? require('../img/nophoto.png') : this.state.photoUrl}
                        alt="暂无图片"
                        style={{
                            width: 'auto',
                            height: '100%',
                            maxWidth: '100%',
                        }} />
                </Modal>

            </div>
        )
    }
}
const SchoolDutyWeekConditionManager = Form.create()(schoolDutyWeekConditionManager)



class DutyWeekConditionInnerTable extends Component {
    constructor(props) {
        super(props);
        this.state = {
            alertVisible: false, //提示
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            // searchText: '',
            filteredInfo: null,
            sortedInfo: null,
            tableLoading: true,
            classnameId: props.classnameId,
            that: props.that,
            innerData: [],



            symbol: props.symbol,


            isMore: true,
        }
        //           this.lookCurrent=this.lookCurrent.bind(this)
        // this.lookMore=this.lookMore.bind(this)

    }


    componentDidMount() {
        this.lookCurrent();
        this.props.onRef(this);
    }

    componentWillReceiveProps(nextProps) {
        this.setState({
            classnameId: nextProps.classnameId

        })

    }

    // handleChange = (pagination, filters, sorter) => {
    //     //console.log('Various parameters', pagination, filters, sorter);
    //     this.setState({
    //         filteredInfo: filters,
    //         sortedInfo: sorter,
    //     });
    // }

    handleChange = (pagination, filters, sorter, extra) => {
        console.log('params', pagination, filters, sorter, extra);
        this.setState({
            filteredInfo: filters,
            sortedInfo: sorter,
        });
    }

    // lookMore() {
    //     this.setState({
    //         tableLoading: true
    //     });
    //     const innerData = [];
    //     getDutyWeekConditionForClassIdApi( parseInt(sessionStorage.getItem("departmentId")), this.state.classnameId, !this.state.isMore)
    //         .then((res) => {

    //             console.log("resdata", res.data)


    //             for (let key in res.data){ 

    //                 console.log("res.data[key].item", res.data[key].item)

    //                 let dayItem= res.data[key].item;
    //                 for (let key2 in dayItem){

    //                     console.log("res.data.item[key2", dayItem[key2])
    //                     let item={
    //                         key: dayItem[key2].createTime+dayItem[key2].item,
    //                         rowSpanDeadline: 0,
    //                         rowSpanCheckpoint: 0,
    //                         // // categoryId: item.categoryId,
    //                         // // categoryName: item.category,
    //                         doneStatus:dayItem[key2].status,
    //                         // // inspectPlanIds: inspectPlanIds,
    //                         category:dayItem[key2].category,
    //                         content:dayItem[key2].content,
    //                         createTime:dayItem[key2].createTime.substring(0, 10),
    //                         realname:dayItem[key2].realname,
    //                         status: dayItem[key2].status,
    //                         item: dayItem[key2].item,

    //                     }
    //                     innerData.push(item)

    //                 }
    //             }





    //             console.log("innerdata", innerData)
    //             // 为了表格的列合并
    //             let countDeadline = 1;
    //             for (let i = innerData.length - 1; i >= 0; i--) {
    //                 if (i == 0) {
    //                     innerData[i].rowSpanDeadline = countDeadline;
    //                     break;
    //                 }
    //                 if (innerData[i].createTime == innerData[i - 1].createTime) {
    //                     countDeadline++;
    //                 } else {
    //                     innerData[i].rowSpanDeadline = countDeadline;
    //                     countDeadline = 1;
    //                 }
    //             }

    //             // 


    //             this.setState({
    //                 innerData: innerData,
    //                 tableLoading: false,
    //                 isMore: true,
    //             })
    //             console.log("isMore", this.state.isMore)



    //         })
    //         .catch((e) => {
    //             if (e.response) {
    //             //请求已发出，服务器返回状态码不是2xx。
    //                 console.info(e.response.data)
    //                 console.info(e.response.status)
    //                 console.info(e.response.headers)
    //             } else if (e.request) {
    //             // 请求已发出，但没有收到响应
    //             // e.request 在浏览器里是一个XMLHttpRequest实例，
    //             // 在node中是一个http.ClientRequest实例
    //                 console.info(e.request)
    //             } else {
    //             //发送请求时异常，捕捉到错误
    //                 console.info('error', e.message)
    //             }
    //             console.info(e.config)
    //         });
    // }

    lookCurrent() {
        this.setState({
            tableLoading: true
        });

        getDutyWeekConditionForClassIdApi(this.state.classnameId, !this.state.isMore)
            .then((res) => {

                console.log("resdata", res.data)

                let innerData = [];

                if (res.data.length) {

                    res.data.map((item1, key2) => {


                        let item11 = {
                            key: key2 + 1,
                            rowSpanDeadline: 0,
                            rowSpanCheckpoint: 0,
                            // // categoryId: item.categoryId,
                            // // categoryName: item.category,
                            // :item.status,
                            // // inspectPlanIds: inspectPlanIds,
                            category: item1.category,
                            content: item1.content || "一切正常",
                            createTime: item1.createTime.substring(0, 10),
                            realname: item1.realName,
                            doneStatus: item1.status,
                            item: item1.item,

                        }
                        innerData.push(item11)
                    })
                        |




                        console.log("innerdata", innerData)
                    // 为了表格的列合并
                    let countDeadline = 1;
                    for (let i = innerData.length - 1; i >= 0; i--) {
                        if (i == 0) {
                            innerData[i].rowSpanDeadline = countDeadline;
                            break;
                        }
                        if (innerData[i].createTime == innerData[i - 1].createTime) {
                            countDeadline++;
                        } else {
                            innerData[i].rowSpanDeadline = countDeadline;
                            countDeadline = 1;
                        }
                    }
                }

                // 


                this.setState({
                    innerData: innerData,
                    tableLoading: false,
                    isMore: false,
                })
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });
    }



    render() {
        let { sortedInfo, filteredInfo } = this.state;
        sortedInfo = sortedInfo || {};
        filteredInfo = filteredInfo || {};
        const innerColumns = [{
            title: '值周日期',
            dataIndex: 'createTime',
            key: 'createTime',
            width: '15%',
            className: 'tableHeadColumn',
            sorter: (a, b) => new Date(a.createTime).getTime() - new Date(b.createTime).getTime(),
            ssortDirections: ['descend', 'ascend'],
            sortOrder: sortedInfo.columnKey === 'createTime' && sortedInfo.order,
            // sortOrder: sortedInfo.columnKey === 'createTime' && sortedInfo.order,
            render: (text, record, index) => {
                const obj = {
                    children: text,
                    props: {},
                };
                obj.props.rowSpan = record.rowSpanDeadline;
                return obj;
            },
        },
        {
            title: '值周巡查项',
            dataIndex: 'item',
            key: 'item',
            width: '25%',
        }, {
            title: '异常记录',
            dataIndex: 'content',
            key: 'content',
            width: '20%',
        }, {
            title: '值周完成情况',
            dataIndex: 'doneStatus',
            key: 'doneStatus',
            width: '10%',

            render: (text, record) => {



                if (record.doneStatus == 1) {
                    return (<div><Tag color={'green'}>通过</Tag></div>)
                } else {
                    return (<div><Tag color={'red'}>有异常</Tag></div>)
                }



            }
        }, {
            title: '值周人姓名',
            dataIndex: 'realname',
            key: 'realname',
            width: '20%',
        },

        ];
        let title = (
            <div
                style={{
                    textAlign: 'center',
                }}>
                {this.state.isMore ?
                    (
                        <a
                            href="javascript:;"
                        >
                            <Button><Icon type="minus-square" />查看最近</Button>

                        </a>
                    ) : null}
            </div>
        )
        let footer = (
            <div
                style={{
                    textAlign: 'center',
                }}>
                {this.state.isMore ?
                    (
                        <a
                            href="javascript:;"
                        >
                            <Button><Icon type="minus-square" />查看最近</Button>

                        </a>
                    ) :
                    (
                        <a
                            href="javascript:;"
                        >
                            <Button><Icon type="plus-square" />查看更多</Button>
                        </a>
                    )}
            </div>
        )
        return (

            this.state.innerData.length == 0 ?
                (<div style={{ textAlign: 'center', color: "#ED5612", fontSize: 17 }}> 暂无值周记录</div>) :
                <Table
                    columns={innerColumns}
                    dataSource={this.state.innerData}
                    onChange={this.handleChange}
                    pagination={true}
                    size='small'
                    loading={this.state.tableLoading}
                    locale={{ emptyText: '暂无数据' }}
                    bordered={true}
                    rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}

                    title={() => title}
                />
        )
    }
}

class UpdateDutypointManualForm extends Component {
    constructor(props) {
        super(props);
        this.state = {
            treeData: [],
            confirmLoading: false,
            alertVisible: false,
            msg: "", //提交失败时的提示语
            expandedKeys: [],
            autoExpandParent: true,
            checkedKeys: [],
            selectedKeys: [],
            visible: props.visible,
            that: props.that,
            selctall: [],
            currentcategoryId: props.currentcategoryId
        };
    }

    componentDidMount() {
        this.refreshData();




    }

    componentWillReceiveProps(nextProps) {
        console.log(nextProps)
        this.setState({
            visible: nextProps.visible,
            that: nextProps.that,
            currentcategoryId: nextProps.currentcategoryId
        });
        console.log(this.state.currentcategoryId)

        this.refreshData();
    }

    refreshData() {
        this.setState({
            confirmLoading: true,
        })
        console.log(this.state.currentcategoryId)

        getCheckpointAndCategoryApi(parseInt(sessionStorage.getItem("departmentId")), parseInt(this.state.currentcategoryId))
            .then((res) => {

                let treeData = [];
                let checkedKeys = [];
                let selctall = [];



                res.data.map((item, index) => {

                    let item1 = {

                        title: item.address,
                        key: item.id,
                        children: []
                    }
                    treeData.push(item1);

                    if (item.isUse == 1) {

                        checkedKeys.push(item.id);
                    }
                    selctall.push(item.id);
                })



                console.log('treeData', treeData);



                this.setState({
                    treeData: treeData,
                    confirmLoading: false,
                    checkedKeys: checkedKeys,
                    selctall: selctall,

                });
               // console.log("zsy", this.state.checkedKeys)




            }

            )
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });
    }

    //修改手册
    handleUpdateClick() {
        this.setState({
            confirmLoading: true
        });
        let values = [];
        let classids = [];
        console.log("classids" + classids)


        // this.state.checkedKeys.forEach((value, index) => {
        //     //let temp = value.split('-');
        //     let temp = value.split('-');
        //     if (temp.length == 3) {
        //         values.push(value);
        //     }
        // })
        ;

        const department = sessionStorage.getItem("departmentId");


        console.log("this.state.currentcategoryId" + this.state.currentcategoryId)
        addCheckpointAndCategoryApi(parseInt(department), parseInt(this.state.currentcategoryId), this.state.checkedKeys)
            .then((res) => {
                if (res.data == "success") {
                    message.success("更新成功!");
                    this.setState({
                        confirmLoading: false
                    });
                    this.state.that.handleUpdateCancel();
                    this.state.that.refreshData();
                } else if (res.data == "fail") {
                    this.setState({
                        alertVisible: true,
                        confirmLoading: false,
                        msg: "修改失败,请检查信息或稍后再试!"
                    });
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });
    }

    //关闭 alert 的提示
    handleClose() {
        this.setState({ alertVisible: false });

    }

    onExpand = (expandedKeys) => {
        this.setState({
            expandedKeys,
            autoExpandParent: false,
        });
    }

    onCheck = (checkedKeys) => {
        //console.log('onCheck', checkedKeys);
        console.log("pointonCheck" + checkedKeys);

        this.setState({ checkedKeys });

    }

    onSelect = (selectedKeys, info) => {


        this.setState({ selectedKeys });
    }

    onChange = (e) => {



        if (e.target.checked) {

            this.setState({
                checkedKeys: this.state.selctall

            })

        }


        else {


            this.setState({
                checkedKeys: []

            })


        }

    }
    renderTreeNodes = data => data.map((item) => {
        if (item.children) {
            let color = { color: "#000000" };
            if (item.schoolId != undefined) {
                if (item.schoolId == 0) { color = { color: "#000000" } }
                else if (item.schoolId != 0) { color = { color: "#FF9966" } }
            }
            if (item)
                return (
                    <TreeNode title={item.title} key={item.key} dataRef={item}>
                        {this.renderTreeNodes(item.children)}
                    </TreeNode>
                );
        }
        return <TreeNode {...item} />;
    })



    render() {
        //console.log('treeData', this.state.treeData);
        return (
            <Drawer
                bodyStyle={{ paddingBottom: 100, paddingRight: 50 }}
                width={800}
                title={'值周打卡点配置'}
                visible={this.state.visible}
                onClose={this.state.that.handleUpdateCancel.bind(this.state.that)}
                destroyOnClose={true}
                closable
            >
                <Alert style={{ textAlign: "left", marginBottom:"15px"}} message="值周打卡点对应设备管理中已关联蓝牙的值周点，勾选的值周打卡点表示在当前值周时间段要去的检查点。" type="info" showIcon />
                <Skeleton loading={this.state.confirmLoading} active>

                    <Checkbox onChange={this.onChange} checked={this.state.checkedKeys.length == this.state.treeData.length ? true : false}>全部</Checkbox>
                    <Tree

                        checkable
                        onExpand={this.onExpand}
                        expandedKeys={this.state.expandedKeys}
                        autoExpandParent={this.state.autoExpandParent}
                        onCheck={this.onCheck}
                        checkedKeys={this.state.checkedKeys}
                        onSelect={this.onSelect}
                        showCheckedStrategy="TreeSelect.SHOW_CHILD"
                        selectedKeys={this.state.selectedKeys}
                    >
                        {this.renderTreeNodes(this.state.treeData)}
                    </Tree>
                    {
                        this.state.alertVisible ?
                            (
                                <Alert message={this.state.msg} type="error" closable afterClose={this.handleClose.bind(this)} />
                            ) : null
                    }
                </Skeleton>
                <div
                    style={{
                        position: 'absolute',
                        left: 0,
                        bottom: 0,
                        width: '100%',
                        borderTop: '1px solid #e9e9e9',
                        padding: '10px 16px',
                        background: '#fff',
                        textAlign: 'right',
                    }}
                >
                    <Row type="flex" justify="space-around" align="middle">
                        {/* <Col span={18}>
                            <Alert style={{ textAlign: "left" }} message="打勾表示已为巡查任务配置该项，再次点击复选框决定本次是否配置该项。" type="info" showIcon />
                        </Col> */}
                        <Col span={21}>
                            <Button size="large" onClick={this.state.that.handleUpdateCancel.bind(this.state.that)}>关闭</Button>
                        </Col>
                        <Col span={3}>
                            <Button type="primary" size="large" loading={this.state.confirmLoading}
                                onClick={this.handleUpdateClick.bind(this)}>保存</Button>
                        </Col>
                    </Row>

                </div>
            </Drawer>
        )
    }

}




class UpdateDutycontentManualForm extends Component {
    constructor(props) {
        super(props);
        this.state = {
            treeData: [],
            confirmLoading: false,
            alertVisible: false,
            msg: "", //提交失败时的提示语
            expandedKeys: [],
            autoExpandParent: true,
            checkedKeys: [],
            selectedKeys: [],
            visible: props.visible,
            that: props.that,
            selectAll: [],
            currentcategoryId: props.currentcategoryId
        };
    }

    componentDidMount() {
        this.refreshData();
    }

    componentWillReceiveProps(nextProps) {

        console.log(nextProps)
        this.setState({
            visible: nextProps.visible,
            that: nextProps.that,
            currentcategoryId: nextProps.currentcategoryId
        });

        this.refreshData();
    }

    refreshData() {
        this.setState({
            confirmLoading: true,
        })
        console.log(this.state.currentcategoryId)
        const department = sessionStorage.getItem("departmentId")
        getDutyallitemApi(parseInt(department), parseInt(this.state.currentcategoryId))
            .then((res) => {

                let treeData = [];
                let checkedKeys = [];
                let selectAll = [];


                res.data.forEach((value, i) => {
                    let item = {

                        title: value.item,
                        key: value.id,
                    }

                    treeData.push(item);
                    if (value.isUse == 1) {
                        checkedKeys.push(value.id)
                    }
                    selectAll.push(value.id);


                })






                this.setState({
                    treeData: treeData,
                    confirmLoading: false,
                    selectAll: selectAll,
                    checkedKeys: checkedKeys,

                });

            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });
    }

    //  修改手册
    handleUpdateClick() {
        this.setState({
            confirmLoading: true
        });


        const department = sessionStorage.getItem("departmentId")

        addDutyUserDefinedContentApi(parseInt(department), parseInt(this.state.currentcategoryId), this.state.checkedKeys)
            .then((res) => {
                if (res.data == "success") {
                    message.success("更新成功!");
                    this.setState({
                        confirmLoading: false
                    });
                    this.state.that.handleUpdateCancel();
                    this.state.that.refreshData();
                } else if (res.data == "fail") {
                    this.setState({
                        alertVisible: true,
                        confirmLoading: false,
                        msg: "修改失败,请检查信息或稍后再试!"
                    });
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });
    }

    //关闭 alert 的提示
    handleClose() {
        this.setState({ alertVisible: false });
    }

    onExpand = (expandedKeys) => {
        this.setState({
            expandedKeys,
            autoExpandParent: false,
        });
    }

    onCheck = (checkedKeys) => {
        //console.log('onCheck', checkedKeys);
        this.setState({ checkedKeys });
        console.log("checkedKeys" + checkedKeys)
    }

    onSelect = (selectedKeys, info) => {
        console.log('onSelect', info);
        this.setState({ selectedKeys });
    }
    onChange = (e) => {


        if (e.target.checked) {

            this.setState({
                checkedKeys: this.state.selectAll

            })

        }


        else {


            this.setState({
                checkedKeys: []

            })


        }

    }

    renderTreeNodes = data => data.map((item) => {
        if (item.children) {
            let color = { color: "#000000" };
            if (item.schoolId != undefined) {
                if (item.schoolId == 0) { color = { color: "#000000" } }
                else if (item.schoolId != 0) { color = { color: "#000000" } }
            }
            if (item)
                return (
                    <TreeNode title={item.title} key={item.key} dataRef={item}>
                        {this.renderTreeNodes(item.children)}
                    </TreeNode>
                );
        }
        return <TreeNode {...item} />;
    })



    render() {
        //console.log('treeData', this.state.treeData);
        return (
            <Drawer
                bodyStyle={{ paddingBottom: 100, paddingRight: 50 }}
                width={800}
                title={'值周内容配置'}
                visible={this.state.visible}
                onClose={this.state.that.handleUpdateCancel.bind(this.state.that)}
                destroyOnClose={true}
                closable
            >
                {/* <Alert style={{ textAlign: "left", marginBottom:"15px"}} message="值周内容为当前值周时间段在当前值周打卡点应该检查的值周项目，请根据实际情况进行勾选" type="info" showIcon /> */}
                <Skeleton loading={this.state.confirmLoading} active>
                    <Checkbox onChange={this.onChange} checked={this.state.checkedKeys.length == this.state.treeData.length ? true : false}>全部</Checkbox>
                    <Tree
                        checkable
                        onExpand={this.onExpand}
                        expandedKeys={this.state.expandedKeys}
                        autoExpandParent={this.state.autoExpandParent}
                        onCheck={this.onCheck}
                        checkedKeys={this.state.checkedKeys}
                        onSelect={this.onSelect}
                        selectedKeys={this.state.selectedKeys}
                    >
                        {this.renderTreeNodes(this.state.treeData)}
                    </Tree>
                    {
                        this.state.alertVisible ?
                            (
                                <Alert message={this.state.msg} type="error" closable afterClose={this.handleClose.bind(this)} />
                            ) : null
                    }
                </Skeleton>
                <div
                    style={{
                        position: 'absolute',
                        left: 0,
                        bottom: 0,
                        width: '100%',
                        borderTop: '1px solid #e9e9e9',
                        padding: '10px 16px',
                        background: '#fff',
                        textAlign: 'right',
                    }}
                >
                    <Row type="flex" justify="space-around" align="middle">
                        {/* <Col span={18}>
                            <Alert style={{ textAlign: "left" }} message="打勾表示为巡查任务配置该项，再次点击复选框决定本次是否配置该项。" type="info" showIcon />
                        </Col> */}
                        <Col span={21}>
                            <Button size="large" onClick={this.state.that.handleUpdateCancel.bind(this.state.that)}>关闭</Button>
                        </Col>
                        <Col span={3}>
                            <Button type="primary" size="large" loading={this.state.confirmLoading}
                                onClick={this.handleUpdateClick.bind(this)}>保存</Button>
                        </Col>
                    </Row>

                </div>
            </Drawer>
        )
    }

}


const deleteclass = []


class DutyweekClassToBluteeth extends Component {

    constructor(props) {
        super(props);

        this.state = {
            modlVisible: false,
            selectedItems: [],
            tableLoading: true,
            classes: [],
            selectrecord: 0,
            columnData2:[],
            addVisible: false,
            fileList: [],
            uploading: false
        }
        this.refreshData = this.refreshData.bind(this);

    }
    componentDidMount() {
        this.refreshData()

    }
    setTableloading(loading) {
        console.log('setTableloading', loading);
        this.setState({
            tableLoading: loading
        })
    }

    showAddModal = () => {

        this.setState({
            addVisible: true,
            fileList: [],
        });
    }

    handleCancel1 = e => {
        //console.log("")
        this.setState({
            addVisible: false,
            fileList: [],
            uploading: false
        });

        message.destroy();
    };

    handleUpload = (e) => {
        let schoolId = sessionStorage.getItem("departmentId")
        const { fileList, buttonFlag } = this.state;
        const formData = new FormData();
        fileList.forEach(file => {
            formData.append('upfile', file);
        });


        this.setState({
            uploading: true,
        });

        message.destroy();
        formData.append('schoolId', schoolId)
        addZhiZhouRelationApi(formData)
        .then(res => {
            if (res.data === "success") {
                message.success("上传成功！");
                this.refreshData();
                // this.props.form.resetFields();
            } else {
                message.error(res.data, 15);
            }
            this.setState({
                uploading: false,
                fileList: [],
            });
        })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            })

    }

    refreshData() {
        console.log("---刷新")
        this.setTableloading(true)
        let columnData = []
        getBlueToothClassUseApi(parseInt(sessionStorage.getItem("departmentId")))
            .then(res => {
                res.data.forEach((item, index) => {
                    columnData.push({
                        key: index + 1,
                        macAddress: item.macAddress,
                        addressNum: item.addressNum,
                        address: item.address

                    });
                });
                this.setState({
                    columnData: columnData,
                    tableLoading: false

                });
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });
    }

    onRef = (ref) => {
        this.child = ref
    }
    handleClickOpenModal = (type, record) => {
        this.setState({
            modlVisible: true,
            selectrecord: record.macAddress

        })

    }

    onExpand =(expanded, record)=>{
        
    }
    
    handleChange = selectedItems => {
        this.setState({ selectedItems });
    }

    setModalVisible(modalVisible) {
        this.setState({ modlVisible: modalVisible });
    }

    confirmDelete = (record) => {
        getClassFromBlueToothApi(parseInt(sessionStorage.getItem("departmentId")), record.macAddress)
            .then(res => {
                res.data.forEach((item) => {
                    deleteclass.push(item.classname)
                });


                deleteBlueToothToClassApi(parseInt(sessionStorage.getItem("departmentId")), deleteclass)
                    .then(res => {
                        if (res.data == 'success') {
                            this.refreshData()

                            success()
                        }
                        else {
                            fail()
                        }
                    })

            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });
    }

    render() {
        const { uploading, fileList } = this.state;
        const props = {
            onRemove: file => {
                this.setState(state => {
                    const index = state.fileList.indexOf(file);
                    const newFileList = state.fileList.slice();
                    newFileList.splice(index, 1);
                    return {
                        fileList: newFileList,
                    };
                });
            },
            beforeUpload: file => {

                this.setState(state => ({
                    fileList: [...state.fileList, file],
                }));

                return false;
            },
            fileList,
        }

        const columns = [{
            title: "序号",
            dataIndex: "key",
            key: "key"
        }, {
            title: "值周打卡点",
            dataIndex: "address",
            key: "address"
        },
        {
            title: "蓝牙编号",
            dataIndex: "macAddress",
            key: "macAddress"
        }, {
            title: "关联值周巡查点数",
            dataIndex: "addressNum",
            key: "addressNum"
        }, {
            title: "操作详情",
            key: "action",
            render: (text, record) => (
                <span>
                    <a onClick={() => this.handleClickOpenModal("update", record)}>修改</a>
                    <Divider type="vertical" />

                    <Popconfirm title="确定删除？" onConfirm={() => { this.confirmDelete(record) }} okText="确定" cancelText="取消">
                        <a>删除</a>
                    </Popconfirm>
                </span>
            ),

        }
        ];



        return (
            <div >

                <div style={{ marginBottom: 16, marginTop: 16 }}>
                <Button type="primary" onClick={() => this.showAddModal()} size="large" style={{ marginLeft: 15 }}>
                        <Icon type="plus" theme="outlined" />导入值周打卡点与巡查点关联
                    </Button>
                    <Button type="primary" onClick={() => this.setModalVisible(true)} style={{ marginLeft: 15 }} size="large">
                        <Icon type="user-add" />新增值周打卡点与巡查点关联
                    </Button>
                    <Button href={ zhizhourelationUploadTemplateUrl } style={{ marginLeft: 15 }} size="large" ><Icon type="download" />下载值周打卡点与巡查点关联模板</Button>
                    {
                        this.state.addVisible ? (
                            <div>
                                <Modal
                                    title={"导入值周打卡点与巡查点关联"}
                                    visible={this.state.addVisible}
                                    onCancel={this.handleCancel1}
                                    maskClosable={false}
                                    footer={[]}
                                    centered={true}
                                    style={{ marginLeft: 15 }}
                                >
                                    <Spin tip="导入数据时间较长，请耐心等待！" spinning={this.state.uploading} size="large">
                                        <Upload {...props}>
                                            <Button >
                                                <Icon type="upload" />选择文件
                                            </Button>
                                        </Upload>
                                        <Button
                                            type="primary"
                                            onClick={this.handleUpload}
                                            disabled={fileList.length === 0}
                                            loading={uploading}
                                            style={{ marginTop: 16 }}
                                        >
                                            {uploading ? '正在上传' : '开始上传'}
                                        </Button>
                                    </Spin>
                                </Modal>
                            </div>
                        )
                            : null
                    }

                    <Modal
                        closable={false}
                        centered
                        destroyOnClose={true}
                        visible={this.state.modlVisible}
                        onOk={() => this.child.handlesubmit()}
                        onCancel={() => this.setModalVisible(false)}
                    >
                        <Steps size="small" current={1}>
                            <Step title="新增值周打卡点与巡查点关联" />
                            {/* <Step title="选择地点及蓝牙" />
                            <Step title="提交完成" /> */}
                        </Steps>

                        <ClassTodeviceForm record={this.state.selectrecord} onRef={(child) => { this.child = child }}
                            submitmodal={this.setModalVisible.bind(this)} refresh={this.refreshData} setSet={this.setTableloading.bind(this)} />
                    </Modal>
                </div>


                <Table
                    dataSource={this.state.columnData}
                    columns={columns}
                    bordered
                    loading={this.state.tableLoading}
                    locale={{ emptyText: '暂无数据' }}
                    // onChange={this.handleChange}
                    onExpand={(expanded, record)=>this.onExpand(expanded, record)}
                    expandedRowRender={(record) => {
                        return (
                            <ClassesWithBlueteethInnerTable
                                refresh={this.refreshData}
                                onRef={this.onRef}
                                macAddress={record.macAddress}
                                that={this} />)
                    }}
                    rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                    pagination={{  //分页
                        // total: this.state.columnData.length, //数据总数量
                        defaultPageSize: 10, //默认显示几条一页
                        //pageSize: 10,
                        showTotal: function (total) {  //设置显示一共几条数据
                            return '共 ' + total + ' 条数据';
                        },
                        showSizeChanger: true,
                        showQuickJumper: true,
                        pageSizeOptions: [5, 10, 20, 30]
                    }} />


            </div>

        )
    }


}
class DutyWeekDisplay extends Component{
   

        constructor(props) {
            super(props);
    
            this.state = {
                modlVisible: false,
                selectedItems: [],
                tableLoading: true,
                classes: [],
                selectrecord: 0,
                columnData2:[]
    
    
    
    
            }
            this.refreshData = this.refreshData.bind(this);
    
        }
        componentDidMount() {
            this.refreshData()
    
        }
        setTableloading(loading) {
            console.log('setTableloading', loading);
            this.setState({
                tableLoading: loading
            })
        }
    
        refreshData() {
            console.log("---刷新")
            this.setTableloading(true)
            let columnData = []
           DisplaygetAllDutyWeekCategoryApi(parseInt(sessionStorage.getItem("departmentId")))
                .then(res => {
                    res.data.forEach((item, index) => {
                        columnData.push({
                            key: index + 1,
                            theme: item.category,
                            content: item.content,
                            schoolId: item.schoolId,
                            categoryId:item.id,
                           
                        });
                    });
                    this.setState({
                        columnData: columnData,
                        tableLoading: false
    
                    });
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message);
                    }
                    console.info(e.config)
                });
        }
    
        onRef = (ref) => {
            this.child = ref
        }
        handleClickOpenModal = (type, record) => {
            this.setState({
                modlVisible: true,
                selectrecord: record.macAddress
    
            })
    
        }
    
        onExpand =(expanded, record)=>{
            
        }
        
        handleChange = selectedItems => {
            this.setState({ selectedItems });
        }
    
        setModalVisible(modalVisible) {
            this.setState({ modlVisible: modalVisible });
        }
    
        confirmDelete = (record) => {
            getClassFromBlueToothApi(parseInt(sessionStorage.getItem("departmentId")), record.macAddress)
                .then(res => {
                    res.data.forEach((item) => {
                        deleteclass.push(item.classname)
                    });
    
    
                    deleteBlueToothToClassApi(parseInt(sessionStorage.getItem("departmentId")), deleteclass)
                        .then(res => {
                            if (res.data == 'success') {
                                this.refreshData()
    
                                success()
                            }
                            else {
                                fail()
                            }
                        })
    
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message);
                    }
                    console.info(e.config)
                });
        }
    
        render() {
    
    
            const columns = [{
                title: "序号",
                dataIndex: "key",
                key: "key"
            }, {
                title: "主题",
                dataIndex: "theme",
                key: "theme"
            },
            {
                title: "值周内容",
                dataIndex: "content",
                key: "content"
            }
            ];
    
    
    
            return (
                <div >
    
                    
    
    
                    <Table
                        dataSource={this.state.columnData}
                        columns={columns}
                        bordered
                        loading={this.state.tableLoading}
                        locale={{ emptyText: '暂无数据' }}
                        // onChange={this.handleChange}
                        onExpand={(expanded, record)=>this.onExpand(expanded, record)}
                        expandedRowRender={(record) => {
                            return (
                                <DisplayCheckpointInnerTable
                                    refresh={this.refreshData}
                                    onRef={this.onRef}
                                    record={record}
                                    that={this} />)
                        }}
                        rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                        pagination={{  //分页
                            // total: this.state.columnData.length, //数据总数量
                            defaultPageSize: 10, //默认显示几条一页
                            //pageSize: 10,
                            showTotal: function (total) {  //设置显示一共几条数据
                                return '共 ' + total + ' 条数据';
                            },
                            showSizeChanger: true,
                            showQuickJumper: true,
                            pageSizeOptions: [5, 10, 20, 30]
                        }} />
    
    
                </div>
    
            )
        }
    
    
    
}

class ClassesWithBlueteethInnerTable extends Component {
    constructor(props) {
        super(props);
        this.state = {
            alertVisible: false, //提示
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            // searchText: '',
            tableLoading: true,
            macAddress: props.macAddress,
            innerData: [],
            that: props.that
        };
    }

    componentDidMount() {
        this.props.onRef(this);
        this.refreshData();
    }

    componentWillReceiveProps(props) {
        this.setState({
            macAddress: props.macAddress,
            that: props.that,
        })
        this.refreshData();
    }

    refreshData() {
        let columnData = []
        console.log(this.state.macAddress)
        getClassFromBlueToothApi(parseInt(sessionStorage.getItem("departmentId")), this.state.macAddress)
            .then(res => {

                res.data.forEach((item, index) => {
                    columnData.push({
                        key: index + 1,
                        classname: item.classname,
                        macAddress: item.macAddress
                    })
                });
                this.setState({
                    columnData: columnData,
                    tableLoading: false,
                });

            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });


    }

    handleSearch = (selectedKeys, confirm) => () => {
        confirm();
        // this.setState({ searchText: selectedKeys[0] });
    }

    handleSearchReset = clearFilters => () => {
        clearFilters();
        // this.setState({ searchText: '' });
    }
    handledelete = (record) => {

        let classs = [];
        classs.push(record.classname);
        deleteBlueToothToClassApi(parseInt(sessionStorage.getItem("departmentId")), classs)
            .then(res => {
                if (res.data == 'success') {
                    this.props.refresh();
                    this.refreshData();
                    success()
                }
                else {
                    fail()
                }




            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });



    }

    render() {
        let innerColumns = [

            {
                title: "序号",
                dataIndex: "key",
                key: "key",
                align: 'center'
            }, {
                title: "值周巡查点",
                dataIndex: "classname",
                key: "macAddress",
                align: 'center'
            },


            {
                title: "操作详情",
                key: "action",
                width: '30%',
                align: 'center',
                render: (text, record) => (
                    <span>
                        <Popconfirm title="确定删除？" okText="确定" cancelText="取消"
                            onConfirm={() => { console.log('record', record); this.handledelete(record) }}>
                            <a href="#">删除</a>
                        </Popconfirm>
                    </span>
                )
            }];

        return (
            <Table
                columns={innerColumns}
                dataSource={this.state.columnData}
                pagination={false}
                size='small'
                loading={this.state.tableLoading}
                locale={{ emptyText: '暂无数据' }}
                bordered={true}
                rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
            />
        )
    }
}
class DisplayCheckpointInnerTable extends Component {
    constructor(props) {
        super(props);
        this.state = {
            alertVisible: false, //提示
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            // searchText: '',
            tableLoading: true,
            record:props.record,
            innerData: [],
            that: props.that
        };
    }

    componentDidMount() {
        this.props.onRef(this);
        this.refreshData();
    }

    componentWillReceiveProps(props) {
        this.setState({
            macAddress: props.macAddress,
            that: props.that,
        })
        this.refreshData();
    }

    refreshData() {
        let columnData = []
        console.log("ss", this.state.record)
        getCheckPointForCategoryApi(this.state.record)
            .then(res => {

                res.data.forEach((item, index) => {
                    columnData.push({
                        key: index + 1,
                        address: item.address,
                        macAddress: item.macAddress,
                        deviceType: item.deviceType,
                        num: item.num
                    })
                });
                this.setState({
                    columnData: columnData,
                    tableLoading: false,
                });

            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });


    }
    onRef = (ref) => {
        this.child = ref
    }
    onExpand =(expanded, record)=>{
            
    }
    handleSearch = (selectedKeys, confirm) => () => {
        confirm();
        // this.setState({ searchText: selectedKeys[0] });
    }

    handleSearchReset = clearFilters => () => {
        clearFilters();
        // this.setState({ searchText: '' });
    }
    handledelete = (record) => {

        let classs = [];
        classs.push(record.classname);
        deleteBlueToothToClassApi(parseInt(sessionStorage.getItem("departmentId")), classs)
            .then(res => {
                if (res.data == 'success') {
                    this.props.refresh();
                    this.refreshData();
                    success()
                }
                else {
                    fail()
                }




            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });



    }

    render() {
        let innerColumns = [

            {
                title: "序号",
                dataIndex: "key",
                key: "key",
                align: 'center'
            }, {
                title: "值周打卡点",
                dataIndex: "address",
                key: "address",
                align: 'center'
            },
            {
                title: "设备类型",
                dataIndex: "deviceType",
                key: "deviceType",
                align: 'center'
            },
            {
                title: "巡查点个数",
                dataIndex: "num",
                key: "num",
                align: 'center'
            }];

        return (
            <Table
                columns={innerColumns}
                dataSource={this.state.columnData}
                pagination={false}
                size='small'
                loading={this.state.tableLoading}
                locale={{ emptyText: '暂无数据' }}
                onExpand={(expanded, record)=>this.onExpand(expanded, record)}
                        expandedRowRender={(record) => {
                            return (
                                <DisplayDutyWeekPlaceInnerTable
                                    refresh={this.refreshData}
                                    onRef={this.onRef}
                                    record={record}
                                    that={this} />)
                        }}
                bordered={true}
                rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
            />
        )
    }
}

class DisplayDutyWeekPlaceInnerTable extends Component {
    constructor(props) {
        super(props);
        this.state = {
            alertVisible: false, //提示
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            // searchText: '',
            tableLoading: true,
            record:props.record,
            innerData: [],
            that: props.that
        };
    }

    componentDidMount() {
        this.props.onRef(this);
        this.refreshData();
    }

    componentWillReceiveProps(props) {
        this.setState({
            macAddress: props.macAddress,
            that: props.that,
        })
        this.refreshData();
    }

    refreshData() {
        let columnData = []
        console.log("ss", this.state.record)
       DisgetClassForBlueToothApi(parseInt(sessionStorage.getItem("departmentId")), this.state.record)
            .then(res => {

                res.data.forEach((item, index) => {
                    columnData.push({
                        key: index + 1,
                        classname: item.classname,
                        
                    })
                });
                this.setState({
                    columnData: columnData,
                    tableLoading: false,
                });

            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });


    }

    handleSearch = (selectedKeys, confirm) => () => {
        confirm();
        // this.setState({ searchText: selectedKeys[0] });
    }

    handleSearchReset = clearFilters => () => {
        clearFilters();
        // this.setState({ searchText: '' });
    }
    handledelete = (record) => {

        let classs = [];
        classs.push(record.classname);
        deleteBlueToothToClassApi(parseInt(sessionStorage.getItem("departmentId")), classs)
            .then(res => {
                if (res.data == 'success') {
                    this.props.refresh();
                    this.refreshData();
                    success()
                }
                else {
                    fail()
                }




            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });



    }

    render() {
        let innerColumns = [

            {
                title: "序号",
                dataIndex: "key",
                key: "key",
                align: 'center'
            }, {
                title: "值周巡查点",
                dataIndex: "classname",
                key: "classname",
                align: 'center'
            }];

        return (
            <Table
                columns={innerColumns}
                dataSource={this.state.columnData}
                pagination={false}
                size='small'
                loading={this.state.tableLoading}
                locale={{ emptyText: '暂无数据' }}
               
                bordered={true}
                rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
            />
        )
    }
}






class classtodeviceForm extends Component {
    constructor(props) {
        super(props);
        this.state = {
            allAddress: [],
            classes: [],
            selectMacaddress: ''
        }
        console.log("props", this.props);
    }

    componentDidMount() {
        this.props.onRef(this);//把自己的控制权交给父组件
        this.refreshData()

    }
    refreshData() {
        getDutyWeekCheckpointApi(parseInt(sessionStorage.getItem("departmentId")), 3)
            .then(res => {
                this.setState({
                    allAddress: res.data
                });
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });

        getDutyWeekClassNotInRelationApi(parseInt(sessionStorage.getItem("departmentId")))
            .then(res => {
                this.setState({
                    classes: res.data
                });
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });
    }

    componentWillReceiveProps(props) {
        let record = props.record;

        console.log(record)

    }


    handlesubmit = e => {
        //  阻止默认提交刷新页面事件
        let selectclasses = this.props.form.getFieldsValue().class;

        updateBlueToothToClassApi(parseInt(sessionStorage.getItem("departmentId")), this.state.selectMacaddress, selectclasses)
            .then(res => {

                if (res.data == 'success') {
                    this.props.submitmodal(false)
                    this.props.refresh()
                    this.props.form.resetFields()
                    success()
                }

                else {
                    fail()
                }


            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            });




    };
    render() {
        const { getFieldDecorator, getFieldValue } = this.props.form;

        console.log('this.props.form;', this.props.form);
        const formItemLayout = {
            labelCol: { span: 5 },
            wrapperCol: { span: 14 },
        };
        const allAddressOption = this.state.allAddress.map(v1 => {
            return (
                <Option value={v1.address} key={v1.macAddress}>{v1.address}</Option>
            );
        });

        const classOption = this.state.classes.map(v => {
            return (
                <Option value={v.classname} >{v.classname}</Option>
            );
        });

        return (

            <div style={{ marginBottom: 16, marginTop: 32 }}>

                <Form onSubmit={this.handlesubmit}>

                    <FormItem
                        label='值周打卡点'
                        {...formItemLayout}>
                        {/* 添加默认值 */}
                        {getFieldDecorator("address", {


                            rules: [{
                                required: true,
                                transform: val => val,
                                type: "string",


                            }]
                        })(
                            <Select

                                size="large"
                                value={parseInt(this.props.record)}

                                onSelect={(value, record) => { this.setState({ selectMacaddress: record.key }); console.log(this.state.selectMacaddress); }}
                                placeholder="请选择值周打卡点"

                            >{allAddressOption}</Select>
                        )}
                    </FormItem>

                    <FormItem
                        label='值周巡查点'
                        {...formItemLayout}>
                        {getFieldDecorator("class", {

                            rules: [{
                                required: true,
                                transform: val => String(val),
                                type: "string",


                            }]
                        })(
                            <Select
                                mode="multiple"
                                size="large"
                                prefix={
                                    <IconFont type="icon-mingcheng" style={{ color: "rgba(0,0,0,.25)" }} />
                                }

                                placeholder="选择值周巡查点"
                                allowClear
                            >{classOption}</Select>
                        )}
                    </FormItem>



                </Form>
            </div>
        );
    }
}
const ClassTodeviceForm = Form.create()(classtodeviceForm);

// class publiczhizhouitemdeploy extends Component {
//     constructor(props) {
//         super(props);
//         this.state = {
//             members: [],
//             schoolId: 0,
//             fileList: [],
//             fileList1: [],
//             uploading: false,
//             uploading1: false,

//         }
//     }

//     componentDidMount() {
//         const avaliablemembers = [];
//         SchoolAllApi()
//             .then((res) => {
//                 res.data.forEach((item, index) => {
//                     //console.log("getAllUser", item);
//                     avaliablemembers.push({
//                         name: item.name,
//                         value: item.id,
//                         address: item.address
//                     });
//                 });
//                 this.setState({
//                     members: avaliablemembers
//                 })
//             })

//     }

//     handleSubmit = e => {
//         e.preventDefault();
//         const { fileList } = this.state;
//         // console.log(fileList);
//         const formData = new FormData();
//         let schoolId = sessionStorage.getItem("departmentId");
//         fileList.forEach((file) => {
//             formData.append('upfile', file);
//         });
//         this.setState({
//             uploading: true,
//         });
//         this.props.form.validateFields((err, values) => {
//             if (!err) {
//                 // formData.append('schoolId', values.schoolId);
//                 formData.append('schoolId', schoolId);
//                 addZhiZhouItemBySchoolIdApi(formData)
//                     .then(res => {
//                         if (res.data === "success") {
//                             message.success("上传成功！");
//                             this.props.form.resetFields();
//                         } else {
//                             message.error(res.data, 15);
//                         }
//                         this.setState({
//                             uploading: false,
//                             fileList: [],
//                         });
//                     })
//                     .catch((e) => {
//                         if (e.response) {
//                             //请求已发出，服务器返回状态码不是2xx。
//                             console.info(e.response.data)
//                             console.info(e.response.status)
//                             console.info(e.response.headers)
//                         } else if (e.request) {
//                             // 请求已发出，但没有收到响应
//                             // e.request 在浏览器里是一个XMLHttpRequest实例，
//                             // 在node中是一个http.ClientRequest实例
//                             console.info(e.request)
//                         } else {
//                             //发送请求时异常，捕捉到错误
//                             console.info('error', e.message);
//                         }
//                         console.info(e.config)
//                     });
//             }
//         });
//     };
//     handleSubmit1 = e => {
//         e.preventDefault();
//         const { fileList1 } = this.state;
//         // console.log(fileList);
//         const formData = new FormData();
//         let schoolId = sessionStorage.getItem("departmentId");
//         fileList1.forEach((file) => {
//             formData.append('upfile', file);
//         });
//         this.setState({
//             uploading1: true,
//         });
//         this.props.form.validateFields((err, values) => {
//             if (!err) {
//                 formData.append('schoolId', schoolId);
//                 addZhiZhouClassNmeBySchoolIdApi(formData)
//                     .then(res => {
//                         if (res.data === "success") {
//                             message.success("上传成功！");
//                             this.props.form.resetFields();
//                         } else {
//                             message.error(res.data, 15);
//                         }
//                         this.setState({
//                             uploading1: false,
//                             fileList1: [],
//                         });
//                     })
//                     .catch((e) => {
//                         if (e.response) {
//                             //请求已发出，服务器返回状态码不是2xx。
//                             console.info(e.response.data)
//                             console.info(e.response.status)
//                             console.info(e.response.headers)
//                         } else if (e.request) {
//                             // 请求已发出，但没有收到响应
//                             // e.request 在浏览器里是一个XMLHttpRequest实例，
//                             // 在node中是一个http.ClientRequest实例
//                             console.info(e.request)
//                         } else {
//                             //发送请求时异常，捕捉到错误
//                             console.info('error', e.message);
//                         }
//                         console.info(e.config)
//                     });
//             }
//         });
//     };

//     render() {
//         const { uploading, fileList, uploading1, fileList1 } = this.state;
//         const { getFieldDecorator } = this.props.form;
//         const avaliablemembers = this.state.members.map((d, index) =>
//             <Option value={d.value} key={index}>
//                 {d.name}
//             </Option>);

//         const formItemLayout = {
//             labelCol: { span: 8 },
//             wrapperCol: { span: 8 },
//         };

//         const tailFormItemLayout = {
//             wrapperCol: {
//                 offset: 8,
//                 span: 8
//             },
//         };

//         const props = {
//             onRemove: (file) => {
//                 this.setState((state) => {
//                     const index = state.fileList.indexOf(file);
//                     const newFileList = state.fileList.slice();
//                     newFileList.splice(index, 1);
//                     return {
//                         fileList: newFileList,
//                     };
//                 });
//             },
//             beforeUpload: (file) => {
//                 this.setState(state => ({
//                     fileList: [...state.fileList, file],
//                 }));
//                 return false;
//             },
//             fileList,
//         };
//         const props1 = {
//             onRemove: (file) => {
//                 this.setState((state) => {
//                     const index = state.fileList1.indexOf(file);
//                     const newFileList = state.fileList1.slice();
//                     newFileList.splice(index, 1);
//                     return {
//                         fileList1: newFileList,
//                     };
//                 });
//             },
//             beforeUpload: (file) => {
//                 this.setState(state => ({
//                     fileList1: [...state.fileList1, file],
//                 }));
//                 return false;
//             },
//             fileList1,
//         };

//         return (
//             <div>
//                 <h3>1.值周项数据导入</h3>
//                 <Form {...formItemLayout} onSubmit={this.handleSubmit}>
//                     {/* <Form.Item label="单位">
//                         {getFieldDecorator('schoolId', {
//                             rules: [
//                                 {
//                                     required: true,
//                                     message: '请选择一个学校',
//                                 },
//                             ],
//                         })(<Select
//                             style={{
//                                 width: '100%'
//                             }}
//                             size="large"
//                             placeholder="选择学校">
//                             {avaliablemembers}
//                         </Select>)}
//                     </Form.Item> */}

//                     <Form.Item label="选择文件">
//                         {getFieldDecorator('message', {
//                             rules: [
//                                 {
//                                     required: true,
//                                     message: '请上传文件',
//                                 },
//                             ],
//                         })(
//                             <Upload {...props}>
//                                 {
//                                     this.state.fileList.length === 0 ?
//                                         (
//                                             <Button >
//                                                 <Icon type="upload" />选择文件
//                                             </Button>
//                                         ) :
//                                         (
//                                             null
//                                         )
//                                 }
//                             </Upload>
//                         )}
//                     </Form.Item>

//                     <Form.Item {...tailFormItemLayout}>
//                         <Button href={zhizhouitemUploadTemplateUrl}  ><Icon type="download" />下载值周项模板</Button>
//                     </Form.Item>

//                     <Form.Item {...tailFormItemLayout}>
//                         <Button type="primary" htmlType="submit">
//                             提交
//                         </Button>
//                     </Form.Item>
//                 </Form>


//                 <div>
//                     <h3>2.值周地点数据导入</h3>
//                     <Form {...formItemLayout} onSubmit={this.handleSubmit1}>
//                         {/* <Form.Item label="单位">
//                             {getFieldDecorator('schoolId', {
//                                 rules: [
//                                     {
//                                         required: true,
//                                         message: '请选择一个学校',
//                                     },
//                                 ],
//                             })(<Select
//                                 style={{
//                                     width: '100%'
//                                 }}
//                                 size="large"
//                                 placeholder="选择学校">
//                                 {avaliablemembers}
//                             </Select>)}
//                         </Form.Item> */}

//                         <Form.Item label="选择文件">
//                             {getFieldDecorator('message', {
//                                 rules: [
//                                     {
//                                         required: true,
//                                         message: '请上传文件',
//                                     },
//                                 ],
//                             })(
//                                 <Upload {...props1}>
//                                     {
//                                         this.state.fileList1.length === 0 ?
//                                             (
//                                                 <Button >
//                                                     <Icon type="upload" />选择文件
//                                                 </Button>
//                                             ) :
//                                             (
//                                                 null
//                                             )
//                                     }
//                                 </Upload>
//                             )}
//                         </Form.Item>

//                         <Form.Item {...tailFormItemLayout}>
//                             <Button href={zhizhouClassNameUploadTemplateUrl}><Icon type="download" />下载值周地点模板</Button>
//                         </Form.Item>

//                         <Form.Item {...tailFormItemLayout}>
//                             <Button type="primary" htmlType="submit">
//                                 提交
//                             </Button>
//                         </Form.Item>
//                     </Form>
//                 </div>
//             </div>
//         )
//     }
// }
// const Publiczhizhouitemdeploy = Form.create()(publiczhizhouitemdeploy);


//---------------------------------------------------------------------------------值周数据模块-------------------------------------------

class ChartAddressQuestionRank extends Component {
    constructor(props) {
        super(props);
        this.state = {
            chartData: props.chartData,
        };
    }

    render() {
        let chartStyle = {
            height: '100%',
            width: '100%',
        };
        let data = this.state.chartData;
        if (this.state.chartData.length > 4) {
            data = this.state.chartData.slice(0, 4);
        }
        return (
            <div id='chartTroublePoint' style={chartStyle}>
                <List
                    itemLayout="horizontal"
                    size='small'
                    dataSource={data}
                    renderItem={(item, index) => {
                        let backgroundColor;
                        let fontColor;
                        if (index < 3) {
                            backgroundColor = '#314659';
                            fontColor = '#fff';
                        } else {
                            backgroundColor = '#f5f5f5';
                            fontColor = 'rgba(0,0,0,.65)';
                        }

                        let firstPaddingTop;
                        if (index == 0) {
                            firstPaddingTop = 4;
                        } else {
                            firstPaddingTop = 8;
                        }
                        return (
                            <List.Item
                                style={{
                                    borderBottom: 0,
                                    paddingTop: firstPaddingTop,
                                }}>
                                <Avatar
                                    style={{
                                        backgroundColor: backgroundColor,
                                        verticalAlign: 'middle',
                                        color: fontColor,
                                        marginLeft: 12,
                                        marginTop: 1,
                                        fontSize: 12,
                                        lineHeight: '22px',
                                    }}
                                    size={20}>
                                    {index + 1}
                                </Avatar>
                                <span
                                    style={{
                                        marginLeft: 20,
                                        flex: '1 1',
                                        marginRight: 12,
                                        overflow: 'hidden',
                                        whiteSpace: 'nowrap',
                                        textOverflow: 'ellipsis',
                                        fontSize: 14,
                                        lineHeight: '22px',
                                        width: 100,
                                    }}>
                                    {item.address}
                                </span>
                                <span
                                    style={{
                                        marginRight: 24,
                                        fontSize: 14,
                                        lineHeight: '22px',
                                    }}>
                                    {item.addressNumber}
                                </span>
                            </List.Item>
                        )
                    }}
                />
            </div>
        )
    }
}

class ChartCategoryItemRank extends Component {
    constructor(props) {
        super(props);
        this.state = {
            chartData: props.chartData,
        };

        console.log("ChartTroubleItem的chartData------------------", props.chartData)
    }

    render() {
        let chartStyle = {
            height: '100%',
            width: '100%',
        };
        let data = this.state.chartData;
        if (this.state.chartData.length > 4) {
            data = this.state.chartData.slice(0, 4);
        }
        return (
            <div id='chartTroubleItem' style={chartStyle}>
                <List
                    itemLayout="horizontal"
                    size='small'
                    dataSource={data}
                    renderItem={(item, index) => {
                        console.log("index================", index)
                        let backgroundColor;
                        let fontColor;
                        if (index < 3) {
                            backgroundColor = '#314659';
                            fontColor = '#fff';
                        } else {
                            backgroundColor = '#f5f5f5';
                            fontColor = 'rgba(0,0,0,.65)';
                        }

                        let firstPaddingTop;
                        if (index == 0) {
                            firstPaddingTop = 4;
                        } else {
                            firstPaddingTop = 8;
                        }
                        return (
                            <List.Item
                                style={{
                                    borderBottom: 0,
                                    paddingTop: firstPaddingTop,
                                }}>
                                <Avatar
                                    style={{
                                        backgroundColor: backgroundColor,
                                        verticalAlign: 'middle',
                                        color: fontColor,
                                        marginLeft: 12,
                                        marginTop: 1,
                                        fontSize: 12,
                                        lineHeight: '22px',
                                    }}
                                    size={20}>
                                    {index + 1}
                                </Avatar>
                                <span
                                    style={{
                                        marginLeft: 20,
                                        flex: '1 1',
                                        marginRight: 12,
                                        overflow: 'hidden',
                                        whiteSpace: 'nowrap',
                                        textOverflow: 'ellipsis',
                                        fontSize: 14,
                                        lineHeight: '22px',
                                        width: 100,
                                    }}>
                                    {item.categoryItem}
                                </span>
                                <span
                                    style={{
                                        marginRight: 24,
                                        fontSize: 14,
                                        lineHeight: '22px',
                                    }}>
                                    {item.dutyweekquestion}
                                </span>
                            </List.Item>
                        )
                    }}
                />
            </div>
        )
    }
}

class ChartDutyWeekDay extends Component {
    constructor(props) {
        super(props);
        this.state = {
            chartData: props.chartData,
            that: props.that,
        };
    }

    componentDidMount() {
        if (JSON.stringify(this.state.chartData) != '{}') {
            console.log("this.state.chartData============", this.state.chartData);
            let chart = echarts.init(document.getElementById('chartInspectDay'));

            let dataZoom;

            if (this.state.chartData.date.length <= 7) {
                dataZoom = [{
                    type: 'inside',
                    start: 0,
                    end: 100
                }, {
                    start: 0,
                    end: 100,
                    handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
                    handleSize: '80%',
                    handleStyle: {
                        color: '#fff',
                        shadowBlur: 3,
                        shadowColor: 'rgba(0, 0, 0, 0.6)',
                        shadowOffsetX: 2,
                        shadowOffsetY: 2
                    }
                }];
            } else {
                dataZoom = [{
                    type: 'inside',
                    start: (this.state.chartData.date.length - 7) / this.state.chartData.date.length * 100,
                    end: 100,
                }, {
                    start: (this.state.chartData.date.length - 7) / this.state.chartData.date.length * 100,
                    end: 100,
                    handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
                    handleSize: '80%',
                    handleStyle: {
                        color: '#fff',
                        shadowBlur: 3,
                        shadowColor: 'rgba(0, 0, 0, 0.6)',
                        shadowOffsetX: 2,
                        shadowOffsetY: 2
                    }
                }];
            }

            chart.setOption({
                tooltip: {
                    trigger: 'axis'
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '40px',
                    top: '30px',
                    containLabel: true
                },
                legend: {
                    data: ['值周次数']
                },
                toolbox: {
                    feature: {
                        saveAsImage: { show: true, },
                        // restore: { show: true },
                        // dataView: { show: true, readOnly: false },
                        magicType: { show: true, type: ['line', 'bar'] },
                        myFullScreen: {
                            show: true,
                            title: '全屏查看',
                            icon: 'path://M160.762 757.972l210.611-210.61 105.66 105.659-210.644 210.643L362.667 960H64V661.15l96.762 96.822zM266.39 160.336L477.032 370.98 371.373 476.64l-210.61-210.61L64 362.848V64h298.667l-96.278 96.336z m491.222 703.328L546.968 653.02l105.659-105.66 210.61 210.61L960 661.152V960H661.333l96.278-96.336z m105.627-597.636l-210.611 210.61-105.66-105.659 210.644-210.643L661.333 64H960v298.85l-96.762-96.822z',
                            onclick: (e) => {
                                var opts = e.getOption()
                                opts.toolbox[0].feature.myFullScreen.show = false;
                                this.state.that.setFullScreen('每日值周次数统计', opts);

                            }
                        }
                    }
                },
                xAxis: {
                    type: 'category',
                    data: this.state.chartData.date,
                    axisTick: {
                        alignWithLabel: true
                    },
                },
                yAxis: {
                    name: '次数',
                    type: 'value'
                },
                dataZoom: dataZoom,
                series: [{
                    name: '值周次数',
                    type: 'bar',
                    symbol: 'none',
                    smooth: true,
                    data: this.state.chartData.times,
                }]

            });
            window.onresize = chart.resize;
        }

    }

    render() {
        let chartStyle = {
            height: '100%',
            width: '100%',
        };
        return (<div id='chartInspectDay' style={chartStyle}></div>)
    }
}

class DutyWeekCharts extends Component {
    constructor(props) {
        super(props);
        this.state = {
            alertVisible: false, //提示
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            tableLoading: true,
            chartsNum: 5,
            doneChartsNum: 0,
            modalTitle: '',
            dutyWeekNumber: {
                dutyweekReal: 0,
                dutyweekAll: 0
            },
            dutyWeekQuestionNumber: {
                dutyweekQuestionDay: 0,
                dutyweekQuestionAll: 0
            },
            dutyWeekCategoryQuestionNumber: [],
            dutyWeekQuestionAddressNumber: [],
            dutyWeekNumberToDay: {
                date: [],
                times: []
            },
            currentdate: ''

        };
    }

    //获取当前时间（年-月-日）
    componentWillMount() {
        var date = new Date();
        var seperator1 = "-";
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = year + seperator1 + month + seperator1 + strDate;
        console.log("currentdate=========", currentdate)
        this.setState({
            currentdate: currentdate
        })
    }

    componentDidMount() {
        this.refreshData();
    }

    refreshData() {
        this.setState({
            confirmLoading: true,
            doneChartsNum: 0,
        });

        let currentdate = this.state.currentdate
        //1.值周当日完成数/累计完成数
        getRealAndAllDutyWeekNumber(parseInt(sessionStorage.getItem('departmentId')), currentdate)
            .then((res) => {
                console.log("res---------------", res.data)
                this.setState({
                    dutyWeekNumber: res.data,
                    doneChartsNum: this.state.doneChartsNum + 1,
                });
                //所有图表数据都加载完成才使骨架屏可见
                console.log('doneChartsNum', this.state.doneChartsNum)
                if (this.state.doneChartsNum == this.state.chartsNum) {
                    this.setState({
                        confirmLoading: false,
                    });
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });


        //2.值周当日问题上报数/累计问题上报数
        getDutyWeekQuestionNumberByDay(parseInt(sessionStorage.getItem('departmentId')), currentdate)
            .then((res) => {
                console.log("res2---------------------------", res.data)

                this.setState({
                    dutyWeekQuestionNumber: res.data,
                    doneChartsNum: this.state.doneChartsNum + 1,
                });
                //所有图表数据都加载完成才使骨架屏可见
                console.log('doneChartsNum', this.state.doneChartsNum)
                if (this.state.doneChartsNum == this.state.chartsNum) {
                    this.setState({
                        confirmLoading: false,
                    });
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });


        //3.值周累计上报值周问题XXX件，其中XXX类问题最多
        let categoryItem = []
        let dutyweekquestion = []
        getDutyWeekQuestionRank(parseInt(sessionStorage.getItem('departmentId')))
            .then((res) => {
                let dutyWeekCategoryQuestionNumber = []

                res.data.dutyWeekQuestionRanK.forEach((item, index) => {
                    dutyWeekCategoryQuestionNumber.push({
                        categoryItem: item.item,
                        dutyweekquestion: item.dutyweekquestion
                    })


                });

                this.setState({
                    dutyWeekCategoryQuestionNumber: dutyWeekCategoryQuestionNumber,
                    doneChartsNum: this.state.doneChartsNum + 1,
                });

                //所有图表数据都加载完成才使骨架屏可见
                console.log('doneChartsNum', this.state.doneChartsNum)
                if (this.state.doneChartsNum == this.state.chartsNum) {
                    this.setState({
                        confirmLoading: false,
                    });
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });

        let address = []
        let addressNumber = []
        //4.值周发现问题地点排名
        getDutyWeekQuestionAddressRank(parseInt(sessionStorage.getItem('departmentId')))
            .then((res) => {
                let dutyWeekQuestionAddressNumber = []
                res.data.dutyWeekQuestionAddressRank.forEach((item, index) => {
                    dutyWeekQuestionAddressNumber.push({
                        address: item.address,
                        addressNumber: item.addressNumber
                    })
                })
                this.setState({
                    dutyWeekQuestionAddressNumber: dutyWeekQuestionAddressNumber,
                    doneChartsNum: this.state.doneChartsNum + 1,
                });

                //所有图表数据都加载完成才使骨架屏可见
                console.log('doneChartsNum', this.state.doneChartsNum)
                if (this.state.doneChartsNum == this.state.chartsNum) {
                    this.setState({
                        confirmLoading: false,
                    });
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });


        //5.每日值周次数
        getDutyWeekNumberToDay(parseInt(sessionStorage.getItem('departmentId')))
            .then((res) => {
                console.log("getDutyWeekNumberToDay=======================", res)
                let chartData = {
                    date: [],
                    times: [],
                };
                res.data.dutyWeekNumberToDay.forEach((item, index) => {
                    chartData.date.push(item.date);
                    chartData.times.push(item.times);
                });
                this.setState({
                    dutyWeekNumberToDay: chartData,
                    doneChartsNum: this.state.doneChartsNum + 1,
                });

                //所有图表数据都加载完成才使骨架屏可见
                console.log('doneChartsNum', this.state.doneChartsNum)
                if (this.state.doneChartsNum == this.state.chartsNum) {
                    this.setState({
                        confirmLoading: false,
                    });
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            })
    }


    setFullScreen(title, opts) {
        this.setState({
            fullScreenVisible: true,
            modalTitle: title
        })
        this.setState({
            fullVisible: true,
        });
        let fullchart = echarts.init(document.getElementById('fullScreen'))
        fullchart.setOption(opts);
    }

    handleCancel() {
        this.setState({
            fullScreenVisible: false,
            calendarVisible: false,
            fullVisible: false,
        })
    }

    render() {
        let gridStyle = {
            marginBottom: 24,
        };

        let winWidth;
        // 获取窗口宽度
        if (window.innerWidth)
            winWidth = window.innerWidth;
        else if ((document.body) && (document.body.clientWidth))
            winWidth = document.body.clientWidth;
        if (winWidth < 1500) {
            //
        }

        return (
            <div style={{ background: '#f0f2f5', margin: -24, }}>
                <Row gutter={24}>
                    <Col span={8}>
                        <Card
                            style={gridStyle}
                            bodyStyle={{
                                height: 160,
                                padding: '12px 16px',
                                backgroundColor: 'rgb(233, 217, 211)',
                            }}
                            bordered={false}>
                            <Skeleton loading={this.state.confirmLoading} active>
                                <Row
                                    style={{ height: '100%' }}
                                    type="flex"
                                    justify="space-around"
                                    align="middle">
                                    <Col span={6}>
                                        <img className="charticon"
                                            src={require("../img/dutyweekNum.png")} />
                                    </Col>
                                    <Col span={18} style={{ width: 200 }}>
                                        <Row style={{
                                            fontSize: "20px",
                                            fontWeight: "bold",
                                            color: "#000",
                                            textAlign: "center",
                                        }}>
                                            <div dangerouslySetInnerHTML={{ __html: '今日值周数/</br>累计值周数' }} />
                                        </Row>
                                        <Row style={{
                                            fontSize: "30px",
                                            fontWeight: "bold",
                                            textAlign: "center",
                                        }}>
                                            {this.state.dutyWeekNumber.realDutyWeekNumber + '/' + this.state.dutyWeekNumber.allDutyWeekNumber}
                                        </Row>
                                    </Col>
                                </Row>
                            </Skeleton>
                        </Card>
                    </Col>
                    <Col span={8}>
                        <Card
                            style={gridStyle}
                            bodyStyle={{
                                height: 160,
                                padding: '12px 16px',
                                backgroundColor: 'rgb(210, 208, 223)',
                            }}
                            bordered={false}>
                            <Skeleton loading={this.state.confirmLoading} active>
                                <Row
                                    style={{ height: '100%' }}
                                    type="flex"
                                    justify="space-around"
                                    align="middle">
                                    <Col span={6}>
                                        <img className="charticon"
                                            src={require("../img/dutyweekReport.png")} />
                                    </Col>
                                    <Col span={18} style={{ width: 200 }}>
                                        <Row style={{
                                            fontSize: "20px",
                                            fontWeight: "bold",
                                            color: "#000",
                                            textAlign: "center",
                                        }}>
                                            <div dangerouslySetInnerHTML={{ __html: '今日问题上报数/</br>累计问题上报数' }} />
                                        </Row>
                                        <Row style={{
                                            fontSize: "30px",
                                            fontWeight: "bold",
                                            textAlign: "center",
                                        }}>
                                            {this.state.dutyWeekQuestionNumber.dutyWeekQuestionNumber + '/' + this.state.dutyWeekQuestionNumber.allDutyWeekQuestionNumber}
                                        </Row>
                                    </Col>
                                </Row>
                            </Skeleton>
                        </Card>
                    </Col>
                </Row>
                <Row gutter={24}>
                    <Col span={16}>
                        <Row>
                            <Card
                                title={'每日值周次数统计'}
                                style={gridStyle}
                                bodyStyle={{ height: 440, padding: 24 }}
                                bordered={false}>
                                <Skeleton loading={this.state.confirmLoading} active>
                                    {
                                        (JSON.stringify(this.state.dutyWeekNumberToDay) == '{"date":[],"times":[]}') ?
                                            (
                                                <Empty
                                                    style={{
                                                        marginTop: 100,
                                                    }} />
                                            ) :
                                            (
                                                <ChartDutyWeekDay
                                                    chartData={this.state.dutyWeekNumberToDay}
                                                    that={this} />
                                            )
                                    }
                                </Skeleton>
                            </Card>
                        </Row>
                    </Col>
                    <Col span={8}>
                        <Row>
                            <Card
                                title={'值周上报问题项目排名'}
                                style={gridStyle}
                                bodyStyle={{ height: 180, padding: 12 }}
                                bordered={false}>
                                <Skeleton loading={this.state.confirmLoading} active>
                                    <ChartCategoryItemRank
                                        chartData={this.state.dutyWeekCategoryQuestionNumber} />
                                </Skeleton>
                            </Card>
                        </Row>
                        <Row>
                            <Card
                                title={'值周上报问题地点排名'}
                                style={gridStyle}
                                bodyStyle={{ height: 180, padding: 12 }}
                                bordered={false}>
                                <Skeleton loading={this.state.confirmLoading} active>
                                    <ChartAddressQuestionRank chartData={this.state.dutyWeekQuestionAddressNumber} />
                                </Skeleton>
                            </Card>
                        </Row>
                    </Col>
                </Row>
                <Modal
                    destroyOnClose
                    visible={this.state.fullScreenVisible}
                    title={this.state.modalTitle}
                    footer={null}
                    width={1000}
                    bodyStyle={{
                        padding: 24,
                        height: 600
                    }}
                    onCancel={() => { this.handleCancel() }}>
                    {this.state.fullVisible ?
                        (
                            <div id='fullScreen'
                                style={{
                                    width: '100%',
                                    height: '100%',
                                }} />
                        ) : undefined
                    }
                </Modal>
            </div>
        )
    }
}




class DutyWeekCategorySet extends Component {

    constructor(props) {
        super(props);
        this.state = {
            addUserVisible: false, //控制新增用户模态框显示隐藏
            updateUserVisible: false, //控制修改用户信息模态框显示隐藏
            alertVisible: false, //提示用户名已存在
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            // searchText: '',
            tableLoading: true,
            identityFilter: [],
            columnData: [],
            filteredInfo: null,
            sortedInfo: null,
            exportUserInfoVisible: false,
            category: ''
        };
    }

    componentDidMount() {
        this.refreshData();
    }

    refreshData() {
        this.setState({
            tableLoading: true
        });
        let columnData = [];
        getAllDutyWeekCategoryApi(sessionStorage.getItem("departmentId"))
            .then((res) => {
                res.data.forEach((item, index) => {
                    //console.log("getAllUser", item);
                    columnData.push({
                        key: index + 1,
                        category: item.category,
                    });
                });
                this.setState({
                    columnData: columnData,
                    tableLoading: false
                });
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });

    }

    test() {
        console.log("测试方法输出")
    }

    //关闭 用户名已存在 的提示
    handleClose() {
        this.setState({ alertVisible: false, exportUserInfoVisible: false });
    }

    showModal() {//展示添加的modal
        this.setState({
            addUserVisible: true,
            exportUserInfoVisible: false
        })
    }

    //关闭模态框
    handleCancel(modal) {
        this.setState({
            alertVisible: false,
            exportUserInfoVisible: false
        });
        if (modal == "addUser") {
            let val = this.refs.addDutyWeekCategoryForm;
            val.resetFields();
            this.setState({
                addUserVisible: false
            });
        }
        if (modal == "updateUser") {
            let val = this.refs.updateDutyWeekCategoryForm;
            val.resetFields();
            this.setState({
                updateUserVisible: false
            });
        }
    }

    //新增用户 点击提交按钮后的操作
    addUserHandleClick() {
        this.setState({
            confirmLoading: true,
            exportUserInfoVisible: false
        });
        let val = this.refs.addDutyWeekCategoryForm;
        val.validateFields((err, values) => {
            if (!err) {
                values.department = sessionStorage.getItem("departmentId");
                // console.log("新增值周主题提交===============", values);
                this.setState({
                    addUserVisible: false,
                    confirmLoading: false
                });
                addDutyWeekCategoryApi(values)
                    .then((res) => {
                        if (res.data == "success") {
                            this.setState({
                                addUserVisible: false,
                                confirmLoading: false
                            });
                            this.refreshData();
                            message.success("添加成功!");
                            val.resetFields();
                        } else if (res.data == "fail") {
                            this.setState({
                                alertVisible: true,
                                confirmLoading: false,
                                msg: "时间段重复!"
                            });
                        }
                    })
                    .catch((e) => {
                        if (e.response) {
                            //请求已发出，服务器返回状态码不是2xx。
                            console.info(e.response.data)
                            console.info(e.response.status)
                            console.info(e.response.headers)
                        } else if (e.request) {
                            // 请求已发出，但没有收到响应
                            // e.request 在浏览器里是一个XMLHttpRequest实例，
                            // 在node中是一个http.ClientRequest实例
                            console.info(e.request)
                        } else {
                            //发送请求时异常，捕捉到错误
                            console.info('error', e.message)
                        }
                        console.info(e.config)
                    });
            } else {
                this.setState({
                    confirmLoading: false
                });
            }
        });
    }

    //点击表格中 修改触发的操作
    updateHandleClick(category) {

        this.setState({
            category: category,
            updateUserVisible: true,
            alertVisible: false,
            exportUserInfoVisible: false
        });
    }

    handleDelete(category) {
        deleteDutyWeekCategoryApi(parseInt(sessionStorage.getItem("departmentId")), category)
            .then((res) => {
                if (res.data == "success") {
                    message.success("删除成功!");
                    this.refreshData();
                } else {
                    message.error('删除失败,请稍后再试!');
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });
    }

    //修改用户信息 点击提交按钮后的操作
    updateUserHandleClick(category) {
        this.setState({
            confirmLoading: true,
            exportUserInfoVisible: false
        });
        let val = this.refs.updateDutyWeekCategoryForm;
        val.validateFields((err, values) => {

            values.department = sessionStorage.getItem("departmentId");
            // console.log("===================", values);
            updateDutyWeekCategoryApi(values.department, values.name, this.state.category)
                .then((res) => {
                    if (res.data == "success") {
                        this.setState({
                            updateUserVisible: false,
                            confirmLoading: false
                        });
                        this.refreshData();
                        message.success("更新成功!");
                        val.resetFields();
                    } else if (res.data == "fail") {
                        this.setState({
                            alertVisible: true,
                            updateUserVisible: true,
                            confirmLoading: false,
                            msg: "修改失败,请检查信息或稍后再试!"
                        });
                    }
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message)
                    }
                    console.info(e.config)
                });


        });
    }



    render() {

        const userColumns = [
            {
                title: "序号",
                dataIndex: "key",
                key: "key"
            },
            {
                title: "值周主题",
                dataIndex: "category",
                key: "category"
            },
            {
                title: "操作详情",
                key: "action",
                render: (text, record) => (
                    <span>
                        <a href="javascript:;" onClick={() => this.updateHandleClick(record.category)}>修改</a>
                        <Divider type="vertical" />

                        <Popconfirm title="确定删除？" okText="确定" cancelText="取消"
                            onConfirm={() => this.handleDelete(record.category)}>
                            <a href="#">删除</a>
                        </Popconfirm>
                    </span>
                )
            }
        ]



        return (
            <div>
                <div style={{ marginBottom: 16 }}>
                    <Button type="primary" onClick={this.showModal.bind(this)} size="large">
                        <Icon type="user-add" />新增值周主题
                    </Button>
                    {/* <Button style={{ marginLeft: '20px' }} type="primary" onClick={this.test.bind(this)} size="large">
                        <Icon type="plus" />批量导入
                    </Button> */}

                    <Modal
                        title="新增值周主题"
                        visible={this.state.addUserVisible}
                        onCancel={this.handleCancel.bind(this, "addUser")}
                        closable
                        footer={[
                            <Button key="submit" type="primary" size="large"
                                loading={this.state.confirmLoading}
                                onClick={this.addUserHandleClick.bind(this)}>提交</Button>
                        ]}
                    >
                        <AddDutyWeekCategoryForm ref="addDutyWeekCategoryForm" />
                        {
                            this.state.alertVisible ?
                                (
                                    <Alert message={this.state.msg} type="error" closable afterClose={this.handleClose.bind(this)} />
                                ) : null
                        }
                    </Modal>
                    <Modal
                        title="修改值周主题"
                        visible={this.state.updateUserVisible}
                        onCancel={this.handleCancel.bind(this, "updateUser")}
                        closable
                        footer={[
                            <Button key="submit" type="primary" size="large"
                                loading={this.state.confirmLoading}
                                onClick={this.updateUserHandleClick.bind(this, this.state.category)}>提交</Button>
                        ]}
                    >

                        <UpdateDutyWeekCategoryForm ref="updateDutyWeekCategoryForm" category={this.state.category} />

                        {
                            this.state.alertVisible ?
                                (
                                    <Alert message={this.state.msg} type="error" closable afterClose={this.handleClose.bind(this)} />
                                ) : null
                        }
                    </Modal>
                </div>
                <Table
                    dataSource={this.state.columnData}
                    columns={userColumns}
                    loading={this.state.tableLoading}
                    locale={{ emptyText: '暂无数据' }}
                    //onChange={this.handleChange}
                    rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                    pagination={{  //分页
                        defaultPageSize: 10, //默认显示几条一页
                        //pageSize: 10,
                        showTotal: function (total) {  //设置显示一共几条数据
                            return '共 ' + total + ' 条数据';
                        },
                        showSizeChanger: true,
                        showQuickJumper: true,
                        pageSizeOptions: [5, 10, 20, 30]
                    }} />
            </div>
        )
    }

}
class DutyWeekContent extends Component{
    constructor(props) {
        super(props);
        this.state = {
            addUserVisible: false, //控制新增用户模态框显示隐藏
            updateUserVisible: false, //控制修改用户信息模态框显示隐藏
            alertVisible: false, //提示用户名已存在
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            // searchText: '',
            tableLoading: true,
            identityFilter: [],
            columnData: [],
            filteredInfo: null,
            sortedInfo: null,
            exportUserInfoVisible: false,
            item: '',
            addVisible: false,
            fileList: [],
            uploading: false
        };
    }

    componentDidMount() {
        this.refreshData();
    }
    handleUpload = (e) => {
        let schoolId = sessionStorage.getItem("departmentId")
        const { fileList, buttonFlag } = this.state;
        const formData = new FormData();
        fileList.forEach(file => {
            formData.append('upfile', file);
        });


        this.setState({
            uploading: true,
        });

        message.destroy();
        formData.append('schoolId', schoolId)
        addZhiZhouItemBySchoolIdApi(formData)
        .then(res => {
            if (res.data === "success") {
                message.success("上传成功！");
                // this.props.form.resetFields();
            } else {
                message.error(res.data, 15);
            }
            this.setState({
                uploading: false,
                fileList: [],
            });
        })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            })

    }
    

    showAddModal = () => {

        this.setState({
            addVisible: true,
            fileList: [],
        });
    }
    refreshData() {
        this.setState({
            tableLoading: true
        });
        let columnData = [];
        getAllDutyWeekContentApi(sessionStorage.getItem("departmentId"))
            .then((res) => {
                res.data.forEach((item, index) => {
                    //console.log("getAllUser", item);
                    columnData.push({
                        key: index + 1,
                        item: item.item,
                    });
                });
                this.setState({
                    columnData: columnData,
                    tableLoading: false
                });
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });

    }

    test() {
        console.log("测试方法输出")
    }

    //关闭 用户名已存在 的提示
    handleClose() {
        this.setState({ alertVisible: false, exportUserInfoVisible: false });
    }

    showModal() {//展示添加的modal
        this.setState({
            addUserVisible: true,
            exportUserInfoVisible: false
        })
    }
    handleCancel1 = e => {
        //console.log("")
        this.setState({
            addVisible: false,
            fileList: [],
            uploading: false
        });

        message.destroy();
    };

    //关闭模态框
    handleCancel(modal) {
        this.setState({
            alertVisible: false,
            exportUserInfoVisible: false
        });
        if (modal == "addUser") {
            let val = this.refs.addDutyWeekContentForm;
            val.resetFields();
            this.setState({
                addUserVisible: false
            });
        }
        if (modal == "updateUser") {
            let val = this.refs.updateDutyWeekContentForm;
            val.resetFields();
            this.setState({
                updateUserVisible: false
            });
        }
    }
    
 //新增值周内容 点击提交按钮后的操作
 addContentHandleClick() {
    this.setState({
        confirmLoading: true,
        exportUserInfoVisible: false
    });
    let val = this.refs.addDutyWeekContentForm;
    val.validateFields((err, values) => {
        if (!err) {
            values.department = sessionStorage.getItem("departmentId");
            //console.log("新增值周内容提交===============", values);
            this.setState({
                addUserVisible: false,
                confirmLoading: false
            });
            addDutyWeekContentApi(values)
                .then((res) => {
                    if (res.data == "success") {
                        this.setState({
                            addUserVisible: false,
                            confirmLoading: false
                        });
                        this.refreshData();
                        message.success("添加成功!");
                        val.resetFields();
                    } else if (res.data == "fail") {
                        this.setState({
                            alertVisible: true,
                            confirmLoading: false,
                            msg: "内容重复!"
                        });
                    }
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message)
                    }
                    console.info(e.config)
                });
        } else {
            this.setState({
                confirmLoading: false
            });
        }
    });
}
    

    //点击表格中 修改触发的操作
    updateHandleClick(item) {

        this.setState({
            item: item,
            updateUserVisible: true,
            alertVisible: false,
            exportUserInfoVisible: false
        });
    }

    handleDelete(item) {
        deleteDutyWeekContentApi(parseInt(sessionStorage.getItem("departmentId")), item)
            .then((res) => {
                if (res.data == "success") {
                    message.success("删除成功!");
                    this.refreshData();
                } else {
                    message.error('删除失败,请稍后再试!');
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });
    }

    //修改值周内容信息 点击提交按钮后的操作
    updatecontentHandleClick(item) {
        this.setState({
            confirmLoading: true,
            exportUserInfoVisible: false
        });
        let val = this.refs.updateDutyWeekContentForm;
        val.validateFields((err, values) => {

            values.department = sessionStorage.getItem("departmentId");
             console.log("===================", values);
            updateDutyWeekContentApi(values.department, values.name, this.state.item)
                .then((res) => {
                    if (res.data == "success") {
                        this.setState({
                            updateUserVisible: false,
                            confirmLoading: false
                        });
                        this.refreshData();
                        message.success("更新成功!");
                        val.resetFields();
                    } else if (res.data == "fail") {
                        this.setState({
                            alertVisible: true,
                            updateUserVisible: true,
                            confirmLoading: false,
                            msg: "修改失败,请检查信息或稍后再试!"
                        });
                    }
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message)
                    }
                    console.info(e.config)
                });


        });
    }



    render() {
        const { uploading, fileList } = this.state;
        const props = {
            onRemove: file => {
                this.setState(state => {
                    const index = state.fileList.indexOf(file);
                    const newFileList = state.fileList.slice();
                    newFileList.splice(index, 1);
                    return {
                        fileList: newFileList,
                    };
                });
            },
            beforeUpload: file => {

                this.setState(state => ({
                    fileList: [...state.fileList, file],
                }));

                return false;
            },
            fileList,
        }
        const userColumns = [
            {
                title: "序号",
                dataIndex: "key",
                key: "key"
            },
            {
                title: "值周内容",
                dataIndex: "item",
                key: "item"
            },
            {
                title: "操作详情",
                key: "action",
                render: (text, record) => (
                    <span>
                        <a href="javascript:;" onClick={() => this.updateHandleClick(record.item)}>修改</a>
                        <Divider type="vertical" />

                        <Popconfirm title="确定删除？" okText="确定" cancelText="取消"
                            onConfirm={() => this.handleDelete(record.item)}>
                            <a href="#">删除</a>
                        </Popconfirm>
                    </span>
                )
            }
        ]



        return (
            <div>
                <div style={{ marginBottom: 16 }}>
                <Button type="primary" onClick={() => this.showAddModal()} size="large" style={{ marginLeft: 15 }}>
                        <Icon type="plus" theme="outlined" />导入值周内容
                    </Button>
                    <Button type="primary" onClick={this.showModal.bind(this)} style={{ marginLeft: 15 }} size="large">
                        <Icon type="user-add" />新增值周内容
                    </Button>
                    <Button href={zhizhouitemUploadTemplateUrl} style={{ marginLeft: 15 }} size="large" ><Icon type="download" />下载值周内容模板</Button>
                    {/* <Button style={{ marginLeft: '20px' }} type="primary" onClick={this.test.bind(this)} size="large">
                        <Icon type="plus" />批量导入
                    </Button> */}
                      {
                        this.state.addVisible ? (


                            <div>

                                <Modal
                                    title={"导入值周内容数据"}
                                    visible={this.state.addVisible}
                                    onCancel={this.handleCancel1}
                                    maskClosable={false}
                                    footer={[]}
                                    centered={true}
                                    style={{ marginLeft: 15 }}
                                >
                                    <Spin tip="导入数据时间较长，请耐心等待！" spinning={this.state.uploading} size="large">
                                        <Upload {...props}>
                                            <Button >
                                                <Icon type="upload" />选择文件
                    </Button>
                                        </Upload>

                                        <Button
                                            type="primary"
                                            onClick={this.handleUpload}
                                            disabled={fileList.length === 0}
                                            loading={uploading}
                                            style={{ marginTop: 16 }}
                                        >
                                            {uploading ? '正在上传' : '开始上传'}
                                        </Button>
                                    </Spin>
                                </Modal>

                            </div>


                        )
                            : null
                    }

                    <Modal
                        title="新增值周内容"
                        visible={this.state.addUserVisible}
                        onCancel={this.handleCancel.bind(this, "addUser")}
                        closable
                        footer={[
                            <Button key="submit" type="primary" size="large"
                                loading={this.state.confirmLoading}
                                onClick={this.addContentHandleClick.bind(this)}>提交</Button>
                        ]}
                    >
                        <AddDutyWeekContentForm ref="addDutyWeekContentForm" />
                        {
                            this.state.alertVisible ?
                                (
                                    <Alert message={this.state.msg} type="error" closable afterClose={this.handleClose.bind(this)} />
                                ) : null
                        }
                    </Modal>
                    <Modal
                        title="修改值周内容"
                        visible={this.state.updateUserVisible}
                        onCancel={this.handleCancel.bind(this, "updateUser")}
                        closable
                        footer={[
                            <Button key="submit" type="primary" size="large"
                                loading={this.state.confirmLoading}
                                onClick={this.updatecontentHandleClick.bind(this, this.state.item)}>提交</Button>
                        ]}
                    >

                        <UpdateDutyWeekContentForm ref="updateDutyWeekContentForm" item={this.state.item} />

                        {
                            this.state.alertVisible ?
                                (
                                    <Alert message={this.state.msg} type="error" closable afterClose={this.handleClose.bind(this)} />
                                ) : null
                        }
                    </Modal>
                </div>
                <Table
                    dataSource={this.state.columnData}
                    columns={userColumns}
                    loading={this.state.tableLoading}
                    locale={{ emptyText: '暂无数据' }}
                    //onChange={this.handleChange}
                    rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                    pagination={{  //分页
                        defaultPageSize: 10, //默认显示几条一页
                        //pageSize: 10,
                        showTotal: function (total) {  //设置显示一共几条数据
                            return '共 ' + total + ' 条数据';
                        },
                        showSizeChanger: true,
                        showQuickJumper: true,
                        pageSizeOptions: [5, 10, 20, 30]
                    }} />
            </div>
        )
    }
    
}
class DutyWeekPlace extends Component{
    constructor(props) {
        super(props);
        this.state = {
            addUserVisible: false, //控制新增用户模态框显示隐藏
            updateUserVisible: false, //控制修改用户信息模态框显示隐藏
            alertVisible: false, //提示用户名已存在
            confirmLoading: false,
            msg: "", //提交失败时的提示语
            // searchText: '',
            tableLoading: true,
            identityFilter: [],
            columnData: [],
            filteredInfo: null,
            sortedInfo: null,
            exportUserInfoVisible: false,
            classname: '',
            addVisible: false,
            fileList: [],
            uploading: false
        };
    }

    componentDidMount() {
        this.refreshData();
    }
    handleUpload = (e) => {
        let schoolId = sessionStorage.getItem("departmentId")
        const { fileList, buttonFlag } = this.state;
        const formData = new FormData();
        fileList.forEach(file => {
            formData.append('upfile', file);
        });


        this.setState({
            uploading: true,
        });

        message.destroy();
        formData.append('schoolId', schoolId)
        addZhiZhouClassNmeBySchoolIdApi(formData)
                    .then(res => {
                        if (res.data === "success") {
                            message.success("上传成功！");
                            
                        } else {
                            message.error(res.data, 15);
                        }
                        this.setState({
                            uploading: false,
                            fileList: [],
                        });
                    })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message);
                }
                console.info(e.config)
            })

    }
    showAddModal = () => {

        this.setState({
            addVisible: true,
            fileList: [],
        });
    }
    refreshData() {
        this.setState({
            tableLoading: true
        });
        let columnData = [];
        getAllDutyWeekPlaceApi(sessionStorage.getItem("departmentId"))
            .then((res) => {
                res.data.forEach((item, index) => {
                    //console.log("getAllUser", item);
                    columnData.push({
                        key: index + 1,
                        classname: item.classname,
                    });
                });
                this.setState({
                    columnData: columnData,
                    tableLoading: false
                });
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });

    }

    test() {
        console.log("测试方法输出")
    }

    //关闭 用户名已存在 的提示
    handleClose() {
        this.setState({ alertVisible: false, exportUserInfoVisible: false });
    }

    showModal() {//展示添加的modal
        this.setState({
            addUserVisible: true,
            exportUserInfoVisible: false
        })
    }
    handleCancel1 = e => {
        //console.log("")
        this.setState({
            addVisible: false,
            fileList: [],
            uploading: false
        });

        message.destroy();
    };
    //关闭模态框
    handleCancel(modal) {
        this.setState({
            alertVisible: false,
            exportUserInfoVisible: false
        });
        if (modal == "addUser") {
            let val = this.refs.addDutyWeekPlaceForm;
            val.resetFields();
            this.setState({
                addUserVisible: false
            });
        }
        if (modal == "updateUser") {
            let val = this.refs.updateDutyWeekPlaceForm;
            val.resetFields();
            this.setState({
                updateUserVisible: false
            });
        }
    }
    
 //新增值周地点 点击提交按钮后的操作
 addPlaceHandleClick() {
    this.setState({
        confirmLoading: true,
        exportUserInfoVisible: false
    });
    let val = this.refs.addDutyWeekPlaceForm;
    val.validateFields((err, values) => {
        if (!err) {
            values.department = sessionStorage.getItem("departmentId");
            //console.log("新增值周地点提交===============", values);
            this.setState({
                addUserVisible: false,
                confirmLoading: false
            });
            addDutyWeekPlaceApi(values)
                .then((res) => {
                    if (res.data == "success") {
                        this.setState({
                            addUserVisible: false,
                            confirmLoading: false
                        });
                        this.refreshData();
                        message.success("添加成功!");
                        val.resetFields();
                    } else if (res.data == "fail") {
                        this.setState({
                            alertVisible: true,
                            confirmLoading: false,
                            msg: "内容重复!"
                        });
                    }
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message)
                    }
                    console.info(e.config)
                });
        } else {
            this.setState({
                confirmLoading: false
            });
        }
    });
}
    

    //点击表格中 修改触发的操作
    updateHandleClick(classname) {

        this.setState({
            classname: classname,
            updateUserVisible: true,
            alertVisible: false,
            exportUserInfoVisible: false
        });
        
    }

    handleDelete(classname) {
        deleteDutyWeekPlaceApi(parseInt(sessionStorage.getItem("departmentId")), classname)
            .then((res) => {
                if (res.data == "success") {
                    message.success("删除成功!");
                    this.refreshData();
                } else {
                    message.error('删除失败,请稍后再试!');
                }
            })
            .catch((e) => {
                if (e.response) {
                    //请求已发出，服务器返回状态码不是2xx。
                    console.info(e.response.data)
                    console.info(e.response.status)
                    console.info(e.response.headers)
                } else if (e.request) {
                    // 请求已发出，但没有收到响应
                    // e.request 在浏览器里是一个XMLHttpRequest实例，
                    // 在node中是一个http.ClientRequest实例
                    console.info(e.request)
                } else {
                    //发送请求时异常，捕捉到错误
                    console.info('error', e.message)
                }
                console.info(e.config)
            });
    }

    //修改值周内容信息 点击提交按钮后的操作
    updateplaceHandleClick(classname) {
        this.setState({
            confirmLoading: true,
            exportUserInfoVisible: false
        });
        let val = this.refs.updateDutyWeekPlaceForm;
        val.validateFields((err, values) => {

            values.department = sessionStorage.getItem("departmentId");
             console.log("===================", values);
            updateDutyWeekPlaceApi(values.department, values.name, this.state.classname)
                .then((res) => {
                    if (res.data == "success") {
                        this.setState({
                            updateUserVisible: false,
                            confirmLoading: false
                        });
                        this.refreshData();
                        message.success("更新成功!");
                        val.resetFields();
                    } else if (res.data == "fail") {
                        this.setState({
                            alertVisible: true,
                            updateUserVisible: true,
                            confirmLoading: false,
                            msg: "修改失败,请检查信息或稍后再试!"
                        });
                    }
                })
                .catch((e) => {
                    if (e.response) {
                        //请求已发出，服务器返回状态码不是2xx。
                        console.info(e.response.data)
                        console.info(e.response.status)
                        console.info(e.response.headers)
                    } else if (e.request) {
                        // 请求已发出，但没有收到响应
                        // e.request 在浏览器里是一个XMLHttpRequest实例，
                        // 在node中是一个http.ClientRequest实例
                        console.info(e.request)
                    } else {
                        //发送请求时异常，捕捉到错误
                        console.info('error', e.message)
                    }
                    console.info(e.config)
                });


        });
    }



    render() {
        const { uploading, fileList } = this.state;
        const props = {
            onRemove: file => {
                this.setState(state => {
                    const index = state.fileList.indexOf(file);
                    const newFileList = state.fileList.slice();
                    newFileList.splice(index, 1);
                    return {
                        fileList: newFileList,
                    };
                });
            },
            beforeUpload: file => {

                this.setState(state => ({
                    fileList: [...state.fileList, file],
                }));

                return false;
            },
            fileList,
        }

        const userColumns = [
            {
                title: "序号",
                dataIndex: "key",
                key: "key"
            },
            {
                title: "值周巡查点",
                dataIndex: "classname",
                key: "classname"
            },
            {
                title: "操作详情",
                key: "action",
                render: (text, record) => (
                    <span>
                        <a href="javascript:;" onClick={() => this.updateHandleClick(record.classname)}>修改</a>
                        <Divider type="vertical" />

                        <Popconfirm title="确定删除？" okText="确定" cancelText="取消"
                            onConfirm={() => this.handleDelete(record.classname)}>
                            <a href="#">删除</a>
                        </Popconfirm>
                    </span>
                )
            }
        ]



        return (
            <div>
                <div style={{ marginBottom: 16 }}>
                <Button type="primary" onClick={() => this.showAddModal()} size="large" style={{ marginLeft: 15 }}>
                        <Icon type="plus" theme="outlined" />导入值周巡查点
                    </Button>
                    <Button type="primary" onClick={this.showModal.bind(this)} style={{ marginLeft: 15 }} size="large">
                        <Icon type="user-add" />新增值周巡查点
                    </Button>
                    <Button href={zhizhouClassNameUploadTemplateUrl} style={{ marginLeft: 15 }} size="large" ><Icon type="download" />下载值周巡查点模板</Button>
                    {/* <Button style={{ marginLeft: '20px' }} type="primary" onClick={this.test.bind(this)} size="large">
                        <Icon type="plus" />批量导入
                    </Button> */}
                    {/* <Alert style={{ display: 'inline', marginLeft: 15 }} message="值周巡查点为具体的值周检查地址，需要在点位配置中与值周打卡点进行关联，一个值周打卡点可设置1个或多个值周巡查点。" type="info" showIcon/> */}
                    <Alert style={{display: 'table', marginLeft: 15, marginTop:10}} message="值周巡查点为具体的值周检查地址，需要在点位配置中与值周打卡点进行关联，一个值周打卡点可设置1个或多个值周巡查点。" type="info" showIcon/> 
                        {
                        this.state.addVisible ? (


                            <div>

                                <Modal
                                    title={"导入值周巡查点"}
                                    visible={this.state.addVisible}
                                    onCancel={this.handleCancel1}
                                    maskClosable={false}
                                    footer={[]}
                                    centered={true}
                                    style={{ marginLeft: 15 }}
                                >
                                    <Spin tip="导入数据时间较长，请耐心等待！" spinning={this.state.uploading} size="large">
                                        <Upload {...props}>
                                            <Button >
                                                <Icon type="upload" />选择文件
                    </Button>
                                        </Upload>

                                        <Button
                                            type="primary"
                                            onClick={this.handleUpload}
                                            disabled={fileList.length === 0}
                                            loading={uploading}
                                            style={{ marginTop: 16 }}
                                        >
                                            {uploading ? '正在上传' : '开始上传'}
                                        </Button>
                                    </Spin>
                                </Modal>

                            </div>


                        )
                            : null
                    }
                    <Modal
                        title="新增值周巡查点"
                        visible={this.state.addUserVisible}
                        onCancel={this.handleCancel.bind(this, "addUser")}
                        closable
                        footer={[
                            <Button key="submit" type="primary" size="large"
                                loading={this.state.confirmLoading}
                                onClick={this.addPlaceHandleClick.bind(this)}>提交</Button>
                        ]}
                    >
                        <AddDutyWeekPlaceForm ref="addDutyWeekPlaceForm" />
                        {
                            this.state.alertVisible ?
                                (
                                    <Alert message={this.state.msg} type="error" closable afterClose={this.handleClose.bind(this)} />
                                ) : null
                        }
                    </Modal>
                    <Modal
                        title="修改值周巡查点"
                        visible={this.state.updateUserVisible}
                        onCancel={this.handleCancel.bind(this, "updateUser")}
                        closable
                        footer={[
                            <Button key="submit" type="primary" size="large"
                                loading={this.state.confirmLoading}
                                onClick={this.updateplaceHandleClick.bind(this, this.state.classname)}>提交</Button>
                        ]}
                    >

                        <UpdateDutyWeekPlaceForm ref="updateDutyWeekPlaceForm" classname={this.state.classname} />

                        {
                            this.state.alertVisible ?
                                (
                                    <Alert message={this.state.msg} type="error" closable afterClose={this.handleClose.bind(this)} />
                                ) : null
                        }
                    </Modal>
                </div>
                <Table
                    dataSource={this.state.columnData}
                    columns={userColumns}
                    loading={this.state.tableLoading}
                    locale={{ emptyText: '暂无数据' }}
                    //onChange={this.handleChange}
                    rowClassName={(record, index) => index % 2 === 0 ? "rowOne" : "rowTwo"}
                    pagination={{  //分页
                        defaultPageSize: 10, //默认显示几条一页
                        //pageSize: 10,
                        showTotal: function (total) {  //设置显示一共几条数据
                            return '共 ' + total + ' 条数据';
                        },
                        showSizeChanger: true,
                        showQuickJumper: true,
                        pageSizeOptions: [5, 10, 20, 30]
                    }} />
            </div>
        )
    }
    
}


class addDutyWeekCategoryForm extends Component {
    constructor(props) {
        super(props);
        this.state = {
            allDepartment: [],
            allIdentity: []
        };
    }

    componentDidMount() {
    }

    render() {
        const { getFieldDecorator } = this.props.form;
        const allIdentityOptions = this.state.allIdentity.map(d => <Option key={d.value}>{d.text}</Option>);
        //console.log(allIdentityOptions);
        const formItemLayout = {
            labelCol: { span: 4 },
            wrapperCol: { span: 16 },
        };

        return (
            <Form>
                <FormItem
                    label='主题'
                    {...formItemLayout}>
                    {getFieldDecorator("name", {
                        initialValue: "",
                        rules: [{
                            required: true,
                            message: "请输入主题名称!"
                        }]
                    })(
                        <Input
                            size="large"
                            prefix={
                                <Icon type="user" style={{ color: "rgba(0,0,0,.25)" }} />
                            }
                            placeholder="请输入主题名称"
                        />
                    )}
                </FormItem>

            </Form>
        );
    }
}
const AddDutyWeekCategoryForm = Form.create()(addDutyWeekCategoryForm);
class addDutyWeekContentForm extends Component{
    constructor(props) {
        super(props);
        this.state = {
            allDepartment: [],
            allIdentity: []
        };
    }

    componentDidMount() {
    }

    render() {
        const { getFieldDecorator } = this.props.form;
        const allIdentityOptions = this.state.allIdentity.map(d => <Option key={d.value}>{d.text}</Option>);
        //console.log(allIdentityOptions);
        const formItemLayout = {
            labelCol: { span: 4 },
            wrapperCol: { span: 16 },
        };

        return (
            <Form>
                <FormItem
                    label='值周内容'
                    {...formItemLayout}>
                    {getFieldDecorator("name", {
                        initialValue: "",
                        rules: [{
                            required: true,
                            message: "请输入值周内容!"
                        }]
                    })(
                        <Input
                            size="large"
                            prefix={
                                <Icon type="user" style={{ color: "rgba(0,0,0,.25)" }} />
                            }
                            placeholder="请输入值周内容"
                        />
                    )}
                </FormItem>

            </Form>
        );
    }
}
const AddDutyWeekContentForm = Form.create()(addDutyWeekContentForm);
class addDutyWeekPlaceForm extends Component{
    constructor(props) {
        super(props);
        this.state = {
            allDepartment: [],
            allIdentity: []
        };
    }

    componentDidMount() {
    }

    render() {
        const { getFieldDecorator } = this.props.form;
        const allIdentityOptions = this.state.allIdentity.map(d => <Option key={d.value}>{d.text}</Option>);
        //console.log(allIdentityOptions);
        const formItemLayout = {
            labelCol: { span: 4 },
            wrapperCol: { span: 16 },
        };

        return (
            <Form>
                <FormItem
                    label='值周地点'
                    {...formItemLayout}>
                    {getFieldDecorator("name", {
                        initialValue: "",
                        rules: [{
                            required: true,
                            message: "请输入值周地点!"
                        }]
                    })(
                        <Input
                            size="large"
                            prefix={
                                <Icon type="user" style={{ color: "rgba(0,0,0,.25)" }} />
                            }
                            placeholder="请输入值周地点"
                        />
                    )}
                </FormItem>

            </Form>
        );
    }
}
const AddDutyWeekPlaceForm = Form.create()(addDutyWeekPlaceForm);
class updateDutyWeekCategoryForm extends Component {
    constructor(props) {
        super(props);
        this.state = {
            category: props.category || []
        };
    }

    componentWillReceiveProps(props) {
        this.setState({
            category: props.category
        });
    }

    componentDidMount() {

    }

    render() {
        const { getFieldDecorator } = this.props.form;
        const formItemLayout = {
            labelCol: { span: 4 },
            wrapperCol: { span: 16 },
        };

        return (
            <Form>
                <FormItem
                    label='主题'
                    {...formItemLayout}>
                    {getFieldDecorator("name", {
                        initialValue: this.state.category,
                        rules: [{
                            required: true,
                            message: '请输入主题名称！',
                        }]
                    })(
                        <Input
                            size="large"
                            prefix={
                                <Icon type="idcard" style={{ color: "rgba(0,0,0,.25)" }} />
                            }
                            placeholder="请输入主题名称"
                        />
                    )}
                </FormItem>
            </Form>
        );
    }
}
const UpdateDutyWeekCategoryForm = Form.create()(updateDutyWeekCategoryForm);
class updateDutyWeekContentForm extends Component {
    constructor(props) {
        super(props);
        this.state = {
            item: props.item || []
        };
    }

    componentWillReceiveProps(props) {
        this.setState({
            item: props.item
        });
    }

    componentDidMount() {

    }

    render() {
        const { getFieldDecorator } = this.props.form;
        const formItemLayout = {
            labelCol: { span: 4 },
            wrapperCol: { span: 16 },
        };

        return (
            <Form>
                <FormItem
                    label='值周内容'
                    {...formItemLayout}>
                    {getFieldDecorator("name", {
                        initialValue: this.state.item,
                        rules: [{
                            required: true,
                            message: '请输入值周内容！',
                        }]
                    })(
                        <Input
                            size="large"
                            prefix={
                                <Icon type="idcard" style={{ color: "rgba(0,0,0,.25)" }} />
                            }
                            placeholder="请输入值周内容"
                        />
                    )}
                </FormItem>
            </Form>
        );
    }
}
const UpdateDutyWeekContentForm = Form.create()(updateDutyWeekContentForm);
class updateDutyWeekPlaceForm extends Component {
    constructor(props) {
        super(props);
        this.state = {
            classname: props.classname || []
        };
    }

    componentWillReceiveProps(props) {
        this.setState({
            classname: props.classname
        });
    }

    componentDidMount() {

    }

    render() {
        const { getFieldDecorator } = this.props.form;
        const formItemLayout = {
            labelCol: { span: 4 },
            wrapperCol: { span: 16 },
        };

        return (
            <Form>
                <FormItem
                    label='值周地点'
                    {...formItemLayout}>
                    {getFieldDecorator("name", {
                        initialValue: this.state.classname,
                        rules: [{
                            required: true,
                            message: '请输入值周地点！',
                        }]
                    })(
                        <Input
                            size="large"
                            prefix={
                                <Icon type="idcard" style={{ color: "rgba(0,0,0,.25)" }} />
                            }
                            placeholder="请输入值周地点"
                        />
                    )}
                </FormItem>
            </Form>
        );
    }
}
const UpdateDutyWeekPlaceForm = Form.create()(updateDutyWeekPlaceForm);
export {
    DutyweekClassToBluteeth, Dutyweeksetup, SchoolDutyWeekConditionManager, 
    // Publiczhizhouitemdeploy,
    DutyWeekCharts, DutyWeekCategorySet, DutyWeekContent, DutyWeekPlace, Dutyweekpointsetup, DutyWeekDisplay
}